0x10000040 $ˆl–äY>”ÊC]ŠqAãB¸'ţà „ž}¿ÂÁÀ2_a ì)g€Wã@sÒddlmZmZmZeZddlmZddlZddl Z ddl m Z ddl m Z ddlmZddlmZddlmZmZdd lmZdd lmZmZmZdd lmZeƒZGd d „d eƒZddd„Z e!dkrÎe ƒdS)é)Úabsolute_importÚdivisionÚprint_function)ÚCLIN)Ú constants)Úcontext)Úoption_helpers)ÚAnsibleOptionsError)Úto_textÚto_bytes)Ú DataLoader)Ú VaultEditorÚVaultLibÚmatch_encrypt_secret)ÚDisplaycs¤eZdZdZdZdZdZdZ‡fdd„Z‡fdd „Z ‡fd d „Z ‡fd d „Z dd„Z e d!dd„ƒZdd„Zd"dd„Zdd„Zdd„Zdd„Zdd„Zdd „Z‡ZS)#ÚVaultCLIa9 can encrypt any structured data file used by Ansible. This can include *group_vars/* or *host_vars/* inventory variables, variables loaded by *include_vars* or *vars_files*, or variable files passed on the ansible-playbook command line with *-e @file.yml* or *-e @file.json*. Role variables and defaults are also included! Because Ansible tasks, handlers, and other objects are data, these can also be encrypted with vault. If you'd like to not expose what variables you are using, you can keep an individual task file entirely encrypted. z ansible-vaultÚstdinzthe command line argszthe interactive promptcs>d|_d|_d|_d|_d|_d|_d|_tt|ƒ  |¡dS)NF) Z b_vault_passZb_new_vault_passÚencrypt_string_read_stdinÚencrypt_secretÚencrypt_vault_idÚnew_encrypt_secretÚnew_encrypt_vault_idÚsuperrÚ__init__)ÚselfÚargs©Ú __class__©ú5/usr/lib/python3.9/site-packages/ansible/cli/vault.pyr-szVaultCLI.__init__c sštt|ƒjddtj tjd¡d�tj j dd�}t  |¡t  |¡|j jdd�}d |_tj j dd�}|jd dd d t ¡d �tj j dd�}|jdgddtdd�|jdd||gd�}|j|jd�|jddddd�|jdd||gd�}|j|jd�|jddddd�|jdd||gd�}|j|jd�|jddddd�|jd d!|gd�}|j|jd�|jddddd�|jd"d#|||gd�} | j|jd�| jddddd�|jd$d%|||gd�} | j|jd�| jdd&d'dd�| jd(d)d*d+d,d-�| jd.d/dd+d0d1�| jd2d3d4d5d6d-�| jd7d8dd9d:�|jd;d<||gd�} | j|jd�|  ¡} | jd=dd>d?t ¡d �| jd@ddAtdBdC�| jddddd�dS)DNz4encryption/decryption utility for Ansible data fileszH See '%s --help' for more information on a specific command. r)ZdescÚepilogF)Úadd_helpÚaction)ÚdestTz--outputÚ output_filez9output file name for encrypt or decrypt; use - for stdout)Údefaultr#ÚhelpÚtypez--encrypt-vault-idrÚstorezMthe vault id used to encrypt (required if more than one vault-id is provided))r%r#r"r'r&ÚcreatezCreate new vault encrypted file)r&Úparents)ÚfuncrZFilenameÚ file_nameÚ*)r&ÚmetavarÚnargsÚdecryptzDecrypt vault encrypted fileÚeditzEdit vault encrypted fileÚviewzView vault encrypted fileÚencryptzEncrypt YAML fileÚencrypt_stringzEncrypt a stringzString to encryptZstring_to_encryptz-pz--promptÚencrypt_string_promptÚ store_truez Prompt for the string to encrypt)r#r"r&z --show-inputÚshow_string_inputz9Do not hide input when prompted for the string to encrypt)r#r%r"r&z-nz--nameÚencrypt_string_namesÚappendzSpecify the variable namez --stdin-nameÚencrypt_string_stdin_namez#Specify the variable name for stdin)r#r%r&ÚrekeyzRe-key a vault encrypted filez--new-vault-password-fileÚnew_vault_password_filez!new vault password file for rekeyz--new-vault-idÚ new_vault_idz'the new vault identity to use for rekey)r%r#r'r&)rrÚ init_parserÚosÚpathÚbasenameÚsysÚargvÚopt_helpÚargparseÚArgumentParserZadd_vault_optionsZadd_verbosity_optionsÚparserÚadd_subparsersÚrequiredÚ add_argumentZ unfrack_pathÚstrÚ add_parserÚ set_defaultsÚexecute_createÚexecute_decryptÚ execute_editÚ