관리-도구
편집 파일: winrm.cpython-39.pyc
a �)g� � @ s� d dl mZmZmZ eZdZd dlZd dlZd dl Z d dl Z d dlZd dlZd dl Z d dlZd dlZd dlZd dlmZ d dlmZ dZzd dlZdZW n ey� Y n0 d dlmZ d d lmZmZ d d lmZ d dlm Z d dl!m"Z" d d l#m$Z$m%Z%m&Z& d dl'm(Z( d dl)m*Z* d dl+m,Z, d dl-m.Z. d dl/m0Z0 zHd dl1Z1d dl1m2Z2 d dl3m4Z4m5Z5m6Z6 d dl7m8Z8 d dl9Z:dZ;dZ<W n. e�y� Z= zdZ;e=Z<W Y dZ=[=n dZ=[=0 0 zd dl>Z>dZ?dZ@W n. e�y� Z= zdZ?e=Z@W Y dZ=[=n dZ=[=0 0 dZAz4d dlBZBeCeBd��r.eeBjDjE�ZFdeFjGv �r.dZAW n& e�yV Z= zW Y dZ=[=n dZ=[=0 0 zd dlHZHdZIW n e�y� dZIY n0 e0� ZJG dd� de*�ZKdS )� )�absolute_import�division�print_functiona; author: Ansible Core Team name: winrm short_description: Run tasks over Microsoft's WinRM description: - Run commands or put/fetch on a target via WinRM - This plugin allows extra arguments to be passed that are supported by the protocol but not explicitly defined here. They should take the form of variables declared with the following pattern C(ansible_winrm_<option>). version_added: "2.0" extends_documentation_fragment: - connection_pipelining requirements: - pywinrm (python library) options: # figure out more elegant 'delegation' remote_addr: description: - Address of the windows machine default: inventory_hostname vars: - name: inventory_hostname - name: ansible_host - name: ansible_winrm_host type: str remote_user: description: - The user to log in as to the Windows machine vars: - name: ansible_user - name: ansible_winrm_user keyword: - name: remote_user type: str remote_password: description: Authentication password for the C(remote_user). Can be supplied as CLI option. vars: - name: ansible_password - name: ansible_winrm_pass - name: ansible_winrm_password type: str aliases: - password # Needed for --ask-pass to come through on delegation port: description: - port for winrm to connect on remote target - The default is the https (5986) port, if using http it should be 5985 vars: - name: ansible_port - name: ansible_winrm_port default: 5986 keyword: - name: port type: integer scheme: description: - URI scheme to use - If not set, then will default to C(https) or C(http) if I(port) is C(5985). choices: [http, https] vars: - name: ansible_winrm_scheme type: str path: description: URI path to connect to default: '/wsman' vars: - name: ansible_winrm_path type: str transport: description: - List of winrm transports to attempt to use (ssl, plaintext, kerberos, etc) - If None (the default) the plugin will try to automatically guess the correct list - The choices available depend on your version of pywinrm type: list elements: string vars: - name: ansible_winrm_transport kerberos_command: description: kerberos command to use to request a authentication ticket default: kinit vars: - name: ansible_winrm_kinit_cmd type: str kinit_args: description: - Extra arguments to pass to C(kinit) when getting the Kerberos authentication ticket. - By default no extra arguments are passed into C(kinit) unless I(ansible_winrm_kerberos_delegation) is also set. In that case C(-f) is added to the C(kinit) args so a forwardable ticket is retrieved. - If set, the args will overwrite any existing defaults for C(kinit), including C(-f) for a delegated ticket. type: str vars: - name: ansible_winrm_kinit_args version_added: '2.11' kinit_env_vars: description: - A list of environment variables to pass through to C(kinit) when getting the Kerberos authentication ticket. - By default no environment variables are passed through and C(kinit) is run with a blank slate. - The environment variable C(KRB5CCNAME) cannot be specified here as it's used to store the temp Kerberos ticket used by WinRM. type: list elements: str default: [] ini: - section: winrm key: kinit_env_vars vars: - name: ansible_winrm_kinit_env_vars version_added: '2.12' kerberos_mode: description: - kerberos usage mode. - The managed option means Ansible will obtain kerberos ticket. - While the manual one means a ticket must already have been obtained by the user. - If having issues with Ansible freezing when trying to obtain the Kerberos ticket, you can either set this to C(manual) and obtain it outside Ansible or install C(pexpect) through pip and try again. choices: [managed, manual] vars: - name: ansible_winrm_kinit_mode type: str connection_timeout: description: - Sets the operation and read timeout settings for the WinRM connection. - Corresponds to the C(operation_timeout_sec) and C(read_timeout_sec) args in pywinrm so avoid setting these vars with this one. - The default value is whatever is set in the installed version of pywinrm. vars: - name: ansible_winrm_connection_timeout type: int N)�getfullargspec)� urlunsplitFT)� constants)�AnsibleError�AnsibleConnectionFailure)�AnsibleFileNotFound)�_filter_non_json_lines)�boolean)�to_bytes� to_native�to_text)�binary_type)�ConnectionBase)� _parse_clixml)�secure_hash)�Display)�Response)� WinRMError�WinRMOperationTimeoutError�WinRMTransportError)�Protocol�spawn�echoc s� e Zd ZdZdZdZdZdZdZ� fdd�Z dd � Z d d� Zdd � Zdd� Z d(dd�Zd)dd�Z� fdd�Zdd� Zd*dd�Zd+� fdd� Zd,d d!�Z� fd"d#�Z� fd$d%�Zd&d'� Z� ZS )-� Connectionz"WinRM connections over HTTP/HTTPS.�winrm)z.ps1z.exe� FTc sz d| _ d| _d | _d | _d | _d| _tt| �j|i |�� t j svt�d�� tj� t�d�� tj� t�d�� tj� d S )NTZ powershellZrequests_credsspZrequests_kerberosZurllib3)Zalways_pipeline_modulesZhas_native_async�protocol�shell_idZdelegateZ_shell_type�superr �__init__�CZ DEFAULT_DEBUG�loggingZ getLoggerZsetLevel�INFO)�self�args�kwargs�� __class__� �D/usr/lib/python3.9/site-packages/ansible/plugins/connection/winrm.pyr"