AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.16.218.240
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python2.7/site-packages/ansible/plugins/connection/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /lib/python2.7/site-packages/ansible/plugins/connection/netconf.pyo
�
��\c@`s�ddlmZmZmZeZdZddlZddlZddl	Z	ddl
mZmZddl
mZmZmZddlmZmZddlmZddlmZyPdd	lmZdd
lmZddlmZddlmZm Z e!Z"Wne#k
re$Z"nXydd
l%m&Z&Wn*e#k
r^ddl'm(Z(e(�Z&nXej)d�j*ej+�idd6dd6dd6dd6Z,defd��YZ-dS(i(tabsolute_importtdivisiontprint_functions�
---
author: Ansible Networking Team
connection: netconf
short_description: Provides a persistent connection using the netconf protocol
description:
  - This connection plugin provides a connection to remote devices over the
    SSH NETCONF subsystem.  This connection plugin is typically used by
    network devices for sending and receiving RPC calls over NETCONF.
  - Note this connection plugin requires ncclient to be installed on the
    local Ansible controller.
version_added: "2.3"
requirements:
  - ncclient
options:
  host:
    description:
      - Specifies the remote device FQDN or IP address to establish the SSH
        connection to.
    default: inventory_hostname
    vars:
      - name: ansible_host
  port:
    type: int
    description:
      - Specifies the port on the remote device to listening for connections
        when establishing the SSH connection.
    default: 830
    ini:
      - section: defaults
        key: remote_port
    env:
      - name: ANSIBLE_REMOTE_PORT
    vars:
      - name: ansible_port
  network_os:
    description:
      - Configures the device platform network operating system.  This value is
        used to load a device specific netconf plugin.  If this option is not
        configured, then the default netconf plugin will be used.
    vars:
      - name: ansible_network_os
  remote_user:
    description:
      - The username used to authenticate to the remote device when the SSH
        connection is first established.  If the remote_user is not specified,
        the connection will use the username of the logged in user.
      - Can be configured form the CLI via the C(--user) or C(-u) options
    ini:
      - section: defaults
        key: remote_user
    env:
      - name: ANSIBLE_REMOTE_USER
    vars:
      - name: ansible_user
  password:
    description:
      - Configures the user password used to authenticate to the remote device
        when first establishing the SSH connection.
    vars:
      - name: ansible_password
      - name: ansible_ssh_pass
  private_key_file:
    description:
      - The private SSH key or certificate file used to to authenticate to the
        remote device when first establishing the SSH connection.
    ini:
      - section: defaults
        key: private_key_file
    env:
      - name: ANSIBLE_PRIVATE_KEY_FILE
    vars:
      - name: ansible_private_key_file
  timeout:
    type: int
    description:
      - Sets the connection time for the communicating with the remote device.
        This timeout is used as the default timeout value when awaiting a
        response after issuing a call to a RPC.  If the RPC does not return in
        timeout seconds, an error is generated.
    default: 120
  host_key_auto_add:
    type: bool
    description:
      - By default, Ansible will prompt the user before adding SSH keys to the
        known hosts file.  Enabling this option, unknown host keys will
        automatically be added to the known hosts file.
      - Be sure to fully understand the security implications of enabling this
        option on production systems as it could create a security vulnerability.
    default: 'no'
    ini:
      - section: paramiko_connection
        key: host_key_auto_add
    env:
      - name: ANSIBLE_HOST_KEY_AUTO_ADD
  look_for_keys:
    default: True
    description:
      -  enables looking for ssh keys in the usual locations for ssh keys (e.g. :file:`~/.ssh/id_*`)
    env:
      - name: ANSIBLE_PARAMIKO_LOOK_FOR_KEYS
    ini:
      - section: paramiko_connection
        key: look_for_keys
    type: boolean
  host_key_checking:
    description: 'Set this to "False" if you want to avoid host key checking by the underlying tools Ansible uses to connect to the host'
    type: boolean
    default: True
    env:
      - name: ANSIBLE_HOST_KEY_CHECKING
      - name: ANSIBLE_SSH_HOST_KEY_CHECKING
      - name: ANSIBLE_NETCONF_HOST_KEY_CHECKING
    ini:
      - section: defaults
        key: host_key_checking
      - section: paramiko_connection
        key: host_key_checking
    vars:
      - name: ansible_host_key_checking
      - name: ansible_ssh_host_key_checking
      - name: ansible_netconf_host_key_checking
  persistent_connect_timeout:
    type: int
    description:
      - Configures, in seconds, the amount of time to wait when trying to
        initially establish a persistent connection.  If this value expires
        before the connection to the remote device is completed, the connection
        will fail
    default: 30
    ini:
      - section: persistent_connection
        key: connect_timeout
    env:
      - name: ANSIBLE_PERSISTENT_CONNECT_TIMEOUT
    vars:
      - name: ansible_connect_timeout
  persistent_command_timeout:
    type: int
    description:
      - Configures, in seconds, the amount of time to wait for a command to
        return from the remote device.  If this timer is exceeded before the
        command returns, the connection plugin will raise an exception and
        close
    default: 10
    ini:
      - section: persistent_connection
        key: command_timeout
    env:
      - name: ANSIBLE_PERSISTENT_COMMAND_TIMEOUT
    vars:
      - name: ansible_command_timeout
  netconf_ssh_config:
    description:
      - This variable is used to enable bastion/jump host with netconf connection. If set to
        True the bastion/jump host ssh settings should be present in ~/.ssh/config file,
        alternatively it can be set to custom ssh configuration file path to read the
        bastion/jump host settings.
    ini:
      - section: netconf_connection
        key: ssh_config
        version_added: '2.7'
    env:
      - name: ANSIBLE_NETCONF_SSH_CONFIG
    vars:
      - name: ansible_netconf_ssh_config
        version_added: '2.7'
N(tAnsibleConnectionFailuretAnsibleError(tto_bytest	to_nativetto_text(t
BOOLEANS_TRUEtBOOLEANS_FALSE(tnetconf_loader(tNetworkConnectionBase(tmanager(tRPCError(tSSHUnknownHostError(tto_eletto_xml(tdisplay(tDisplaytncclienttnexustnxostdefaulttiostalutsrosthuaweitcet
ConnectioncB`sDeZdZdZeZd�Zded�Z	d�Z
d�ZRS(sNetConf connectionstnetconfcO`satt|�j||||�|jp+d|_tjd|jdt�d|_d|_dS(NRsnetwork_os is set to %stlog_only(	tsuperRt__init__t_network_osRtTruetNonet_managertkey_filename(tselftplay_contextt	new_stdintargstkwargs((sF/usr/lib/python2.7/site-packages/ansible/plugins/connection/netconf.pyR �s
	cC`s�|jr�tt|dd��}|dkr1dSy|jj|�}WnDtk
r�}|jdtt|j	�dd��}t
j|�SX|jSt
t|�j|||�SdS(sSends the request to the node and returns the reply
        The method accepts two forms of request.  The first form is as a byte
        string that represents xml string be send over netconf session.
        The second form is a json-rpc (2.0) byte string.
        terrorstsurrogate_or_strictsunable to parse requesttdataN(R$RRR#trpcR
tinternal_errorRRtxmltjsontdumpstdata_xmlRRtexec_command(R&tcmdtin_datatsudoabletrequesttreplytexcterror((sF/usr/lib/python2.7/site-packages/ansible/plugins/connection/netconf.pyR4�s	'c	C`sWtstd��ntt|�j�tjddt�t}|jjdk	r\t
}nt|jd|�|jjp�|j
d�|_|jr�ttjj|j��|_n|jdkrxUtjdt�D]>}|j|�}|r�tjd|dt�||_q�q�Wnitj|j�p9|jd	6}|j
d
�}|tkrdt}n|tkryd}ny�|jjp�d}tjd|jj||jjf�tj d
|jjd|d|jjd|jjd|jd|j
d�d|j
d�d|d|jj!d|jj"d|�|_#WnOt$k
r`}t%t|���n+t&k
r�}tdj'|j���nX|j#j(s�d"Stjddt�t|_)tj|j|�}|r�tjd|jdt�n&tjd|�}tjd|j�|j*j+|�tt|�j�dt,|j#j-d d!�dfS(#NsXncclient is required to use the netconf connection type.
Please run pip install ncclients&ssh connection done, starting ncclientRtallow_agenttprivate_key_fileRt
class_onlysdiscovered network_os %stnametnetconf_ssh_configi>s>ESTABLISH NETCONF SSH CONNECTION FOR USER: %s on PORT %s TO %sthosttporttusernametpasswordR%thostkey_verifythost_key_checkingt
look_for_keyst
device_paramsttimeoutt
ssh_configs*connection=netconf is not supported on {0}its
not connecteds,ncclient manager object created successfullys'loaded netconf plugin for network_os %ssOunable to load netconf plugin for network_os %s, falling back to default pluginiR+R,(iRKs
not connected(.tHAS_NCCLIENTRRRt_connectRR"t
_play_contextRDR#tFalsetsetattrR=t
get_optionR%tstrtostpatht
expanduserR!R
talltguess_network_ostNETWORK_OS_DEVICE_PARAM_MAPtgetRR	RBtvvvvtremote_usertremote_addrRtconnectR<RIR$RRtImportErrortformatt	connectedt
_connectedt_implementation_pluginstappendRt
session_id(	R&R<tclst
network_osRHRJRBR:R((sF/usr/lib/python2.7/site-packages/ansible/plugins/connection/netconf.pyRM�sp		!"						cC`s0|jr|jj�ntt|�j�dS(N(R$t
close_sessionRRtclose(R&((sF/usr/lib/python2.7/site-packages/ansible/plugins/connection/netconf.pyRhEs	N(t__name__t
__module__t__doc__t	transportROthas_pipeliningR R#R"R4RMRh(((sF/usr/lib/python2.7/site-packages/ansible/plugins/connection/netconf.pyR�s			K(.t
__future__RRRttypet
__metaclass__t
DOCUMENTATIONRStloggingR1tansible.errorsRRtansible.module_utils._textRRRt)ansible.module_utils.parsing.convert_boolRR	tansible.plugins.loaderR
tansible.plugins.connectionRRRtncclient.operationsR
tncclient.transport.errorsRt
ncclient.xml_RRR"RLR^ROt__main__Rtansible.utils.displayRt	getLoggertsetLeveltINFORXR(((sF/usr/lib/python2.7/site-packages/ansible/plugins/connection/netconf.pyt<module>s<�







Anon7 - 2022
AnonSec Team