Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3.11/site-packages/ansible/cli/__pycache__/ |
Upload File : |
� ���c�W � � � d dl mZmZmZ eZd dlmZ d dlZd dl Z d dl mZ d dl m Z d dlmZ d dlmZ d dlmZmZ d d lmZ d d lmZmZmZ d dlmZ e� � Z G d� d e� � Zdd�Z e!dk r e � � dS dS )� )�absolute_import�division�print_function)�CLIN)� constants)�context)�option_helpers)�AnsibleOptionsError)�to_text�to_bytes)� DataLoader)�VaultEditor�VaultLib�match_encrypt_secret)�Displayc � � � e Zd ZdZdZdZdZdZ� fd�Z� fd�Z � fd�Z � fd �Zd � Ze dd�� � Zd � Zdd�Zd� Zd� Zd� Zd� Zd� Z� xZS )�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 promptc � �� d | _ d | _ d| _ d | _ d | _ d | _ d | _ t t | � � � |� � d S )NF) �b_vault_pass�b_new_vault_pass�encrypt_string_read_stdin�encrypt_secret�encrypt_vault_id�new_encrypt_secret�new_encrypt_vault_id�superr �__init__)�self�args� __class__s ��6/usr/lib/python3.11/site-packages/ansible/cli/vault.pyr zVaultCLI.__init__- s_ �� � ��� $���).��&�"��� $���"&���$(��!� �h����&�&�t�,�,�,�,�,� c �v �� t t | � � � ddt j � t j d � � z �� � t j � d�� � }t j |� � t j |� � | j � d�� � }d |_ t j � d�� � }|� d d ddt j � � � � � t j � d�� � }|� dg ddt$ d�� � |� dd||g�� � }|� | j �� � |� dddd�� � |� dd||g�� � }|� | j �� � |� dddd�� � |� dd||g�� � }|� | j �� � |� dddd�� � |� d d!|g�� � }|� | j �� � |� dddd�� � |� d"d#|||g�� � } | � | j �� � | � dddd�� � |� d$d%|||g�� � } | � | j �� � | � dd&d'd�� � | � d(d)d*d+d,�-� � | � d.d/dd+d0�1� � | � d2d3d4d5d6�-� � | � d7d8d d9�:� � |� d;d<||g�� � }|� | j �� � |� � � }|� d=d d>d?t j � � � � � |� d@d dAt$ dB�C� � |� dddd�� � d S )DNz4encryption/decryption utility for Ansible data fileszH See '%s <command> --help' for more information on a specific command. r )�desc�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)�funcr �Filename� 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 encrypt�string_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, )r r �init_parser�os�path�basename�sys�argv�opt_help�argparse�ArgumentParser�add_vault_options�add_verbosity_options�parser�add_subparsers�required�add_argument�unfrack_path�str� add_parser�set_defaults�execute_create�execute_decrypt�execute_edit�execute_view�execute_encrypt�execute_encrypt_string� execute_rekey�add_mutually_exclusive_group)r �common� subparsers�output�vault_id� create_parser�decrypt_parser�edit_parser�view_parser�encrypt_parser�enc_str_parser�rekey_parser�rekey_new_groupr! s �r"