Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/nxos/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_aaa_server_host.pyo

�
�Udac@s�idd6dgd6dd6ZdZdZdZd	d
lZd	dlmZmZd	dlmZm	Z	d	d
l
mZd�Zd�Z
d�Zd�Zd�Zedkr�e�nd
S(s1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys�
---
module: nxos_aaa_server_host
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Manages AAA server host-specific configuration.
description:
    - Manages AAA server host-specific configuration.
author: Jason Edelman (@jedelman8)
notes:
    - Tested against NXOSv 7.3.(0)D1(1) on VIRL
    - Changes to the host key (shared secret) are not idempotent for type 0.
    - If C(state=absent) removes the whole host configuration.
options:
    server_type:
        description:
            - The server type is either radius or tacacs.
        required: true
        choices: ['radius', 'tacacs']
    address:
        description:
            - Address or name of the radius or tacacs host.
        required: true
    key:
        description:
            - Shared secret for the specified host or keyword 'default'.
    encrypt_type:
        description:
            - The state of encryption applied to the entered key.
              O for clear text, 7 for encrypted. Type-6 encryption is
              not supported.
        choices: ['0', '7']
    host_timeout:
        description:
            - Timeout period for specified host, in seconds or keyword 'default.
              Range is 1-60.
    auth_port:
        description:
            - Alternate UDP port for RADIUS authentication or keyword 'default'.
    acct_port:
        description:
            - Alternate UDP port for RADIUS accounting or keyword 'default'.
    tacacs_port:
        description:
            - Alternate TCP port TACACS Server or keyword 'default'.
    state:
        description:
            - Manage the state of the resource.
        default: present
        choices: ['present','absent']
s�
# Radius Server Host Basic settings
  - name: "Radius Server Host Basic settings"
    nxos_aaa_server_host:
        state: present
        server_type: radius
        address: 1.2.3.4
        acct_port: 2084
        host_timeout: 10

# Radius Server Host Key Configuration
  - name: "Radius Server Host Key Configuration"
    nxos_aaa_server_host:
        state: present
        server_type: radius
        address: 1.2.3.4
        key: hello
        encrypt_type: 7

# TACACS Server Host Configuration
  - name: "Tacacs Server Host Configuration"
    nxos_aaa_server_host:
        state: present
        server_type: tacacs
        tacacs_port: 89
        host_timeout: 10
        address: 5.6.7.8

s\
proposed:
    description: k/v pairs of parameters passed into module
    returned: always
    type: dict
    sample: {"address": "1.2.3.4", "auth_port": "2084",
            "host_timeout": "10", "server_type": "radius"}
existing:
    description:
        - k/v pairs of existing configuration
    returned: always
    type: dict
    sample: {}
end_state:
    description: k/v pairs of configuration after module execution
    returned: always
    type: dict
    sample: {"address": "1.2.3.4", "auth_port": "2084",
            "host_timeout": "10", "server_type": "radius"}
updates:
    description: command sent to the device
    returned: always
    type: list
    sample: ["radius-server host 1.2.3.4 auth-port 2084 timeout 10"]
changed:
    description: check to see if a change was made on the device
    returned: always
    type: bool
    sample: true
i����N(tload_configtrun_commands(tget_capabilitiestnxos_argument_spec(t
AnsibleModulecCs{t|�}|jdd�}|dkrE|g}t||�}n2|dkrwi|d6dd6}t||�}n|S(Ntnetwork_apitnxapitcliconftcommandttexttoutput(RtgetR(R
tmoduletdevice_infoR
tcmdstbody((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_aaa_server_host.pytexecute_show_command�s	cCsGg}x:|D]2}t|t�r2|j|�q
|j|�q
W|S(N(t
isinstancetlisttextendtappend(t
command_liststflat_command_listR
((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_aaa_server_host.pytflatten_list�s
cCs�i}dj||�}t||�d}|r�yMd|kr�d}tj||�}|jd�|d<|dr�|djdd�|d<d	|d
<n|jd�|d<|jd
�|d<|jd�|d<n�d|krid}tj||�}|jd�|d<|dr@|djdd�|d<d	|d
<n|jd�|d<|jd
�|d<n||d<||d<Wq�tk
r�iSXniS|S(Ns"show run | inc {0}-server.host.{1}itradiuss�\S+ host \S+(?:\s+key 7\s+(\S+))?(?:\s+auth-port (\d+))?(?:\s+acct-port (\d+))?(?:\s+authentication)?(?:\s+accounting)?(?:\s+timeout (\d+))?itkeyt"tt7tencrypt_typeit	auth_portit	acct_portithost_timeoutttacacssH\S+ host \S+(?:\s+key 7\s+(\S+))?(?:\s+port (\d+))?(?:\s+timeout (\d+))?ttacacs_porttserver_typetaddress(tformatRtretsearchtgrouptreplacet	TypeError(RR(R)t
aaa_host_infoR
Rtpatterntmatch((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_aaa_server_host.pytget_aaa_host_info�s<





c
Cs�g}dj||�}d|}|jd�}|jdd�}t}	t}
|r�|dkr�|j|dj||��q�|j|dj|jd���nid	d
6dd6d
d6dd6}x�d
dddgD]t}|j|�}|r�|dkr+|dj|j|�|�7}t}
qP|dj|j|��7}t}	q�q�W|	rj|j|�n|
sw|r�|j|�n|S(Ns{0}-server host {1}sno RR"R tdefaults key {0} {1}s
 key 7 {0}s	auth-portR#s	acct-portR$tportR'ttimeoutR%s {0} {1}s {0} 1(R*RtFalseRtTrue(
R(R)tparamstexistingRtcmd_strt
cmd_no_strRtenc_typetdefvaltnondeftlocdicttitem((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_aaa_server_host.pytconfig_aaa_host�s4
 &	

cCsEtdtdddgdt�dtdddt�d	tddd
t�dtddddd
g�dtdd�dtdd�dtdd�dtdd�dtdddgdd��	}|jt�td|dt�}t�}|jd}|jd}|jd	}|jd}|jd}|jd}|jd}	|jd}
|jd}td|d|d	|d|d|d|d|	d|
�}td�|j�D��}
t}|r�|r�|j	dd�n|
r|dkr|j	dd�n|s|	r+|dkr+|j	dd�nt
|||�}|}g}i}|dkr|sj|
}nvxs|
j�D]e\}}|dkr�|||<n||j|�krw|dks�|j|�r�|||<q�qwqwWt||||�}|r�|j
|�q�n�|dkr�tt|
j��j|j���}|jd�r�|jd�r�dj|jd�|jd��}|j
|�q�nt|�}|r�|jr�|jdtd|�q�t}t||�t
|||�}ni}|
|d <||d!<||d"<||d<||d#<||d$<|j|�dS(%NR(tchoicesRR&trequiredR)ttypetstrRtno_logR"t0R!R%R#R$R'tstatetabsenttpresentR4t
argument_spectsupports_check_modecss-|]#\}}|dk	r||fVqdS(N(tNone(t.0tktv((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_aaa_server_host.pys	<genexpr>stmsgs"encrypt_type must be used with keys4tacacs_port can only be used with server_type=tacacss?auth_port and acct_port can only be usedwhen server_type=radiussno {0}-server host {1}tchangedtcommandstproposedR:tupdatestwarningst	end_state(tdictR8tupdateRR	RR9titemsR7t	fail_jsonR3RRBRtsettintersectionR*Rt
check_modet	exit_jsonR(RLRRWR(R)RR"R%R#R$R'RItargsRURSR:RXRTtdeltatvalueR
t	intersectRtresults((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_aaa_server_host.pytmain�s�
		








	
	
	
$	






t__main__(tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR+t&ansible.module_utils.network.nxos.nxosRRRRtansible.module_utils.basicR	RRR3RBRft__name__(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_aaa_server_host.pyt<module>s 


5		
	(	&	a

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]