Anons79 Mini Shell

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

�
�Udac@sidd6dgd6dd6ZdZdZdZd	d
lZd	dlmZd	dlmZm	Z	d	d
lm
Z
mZd	dlm
Z
d
ad�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zedkre�nd
S(s1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys�
---
module: ios_system
version_added: "2.3"
author: "Peter Sprygada (@privateip)"
short_description: Manage the system attributes on Cisco IOS devices
description:
  - This module provides declarative management of node system attributes
    on Cisco IOS devices.  It provides an option to configure host system
    parameters or remove those parameters from the device active
    configuration.
extends_documentation_fragment: ios
notes:
  - Tested against IOS 15.6
options:
  hostname:
    description:
      - Configure the device hostname parameter. This option takes an ASCII string value.
  domain_name:
    description:
      - Configure the IP domain name
        on the remote device to the provided value. Value
        should be in the dotted name form and will be
        appended to the C(hostname) to create a fully-qualified
        domain name.
  domain_search:
    description:
      - Provides the list of domain suffixes to
        append to the hostname for the purpose of doing name resolution.
        This argument accepts a list of names and will be reconciled
        with the current active configuration on the running node.
  lookup_source:
    description:
      - Provides one or more source
        interfaces to use for performing DNS lookups.  The interface
        provided in C(lookup_source) must be a valid interface configured
        on the device.
  lookup_enabled:
    description:
      - Administrative control
        for enabling or disabling DNS lookups.  When this argument is
        set to True, lookups are performed and when it is set to False,
        lookups are not performed.
    type: bool
  name_servers:
    description:
      - List of DNS name servers by IP address to use to perform name resolution
        lookups.  This argument accepts either a list of DNS servers See
        examples.
  state:
    description:
      - State of the configuration
        values in the device's current active configuration.  When set
        to I(present), the values should be configured in the device active
        configuration and when set to I(absent) the values should not be
        in the device active configuration
    default: present
    choices: ['present', 'absent']
s�
- name: configure hostname and domain name
  ios_system:
    hostname: ios01
    domain_name: test.example.com
    domain_search:
      - ansible.com
      - redhat.com
      - cisco.com

- name: remove configuration
  ios_system:
    state: absent

- name: configure DNS lookup sources
  ios_system:
    lookup_source: MgmtEth0/0/CPU0/0
    lookup_enabled: yes

- name: configure name servers
  ios_system:
    name_servers:
      - 8.8.8.8
      - 8.8.4.4
s�
commands:
  description: The list of configuration mode commands to send to the device
  returned: always
  type: list
  sample:
    - hostname ios01
    - ip domain name test.example.com
i����N(t
AnsibleModule(t
get_configtload_config(tios_argument_spect
check_args(tComplexListcCs>tdk	r|tkSt|�}tjd|�a|tkS(Nsvrf definition (\S+)(t_CONFIGURED_VRFStNoneRtretfindall(tmoduletvrftconfig((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_system.pythas_vrf�s

cCs*t||�s&|jdd|�ndS(Ntmsgsvrf %s is not configured(Rt	fail_json(RR((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_system.pytrequires_vrf�scCsTg|D]}||kr|^q}g|D]}||kr,|^q,}||fS(N((twantthavetwtaddsthtremoves((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_system.pyt	diff_list�s%%csnt�}|jd}��fd�}|dkr7�ddkrT|jd�n�drv|jd�d�n�d	tkr�|jd
�nt�}x~�dD]r}|dr�|d|kr�|j|d�|jd
|d�q�d|kr�|jd�|jd�q�q�Wt�}x~�dD]r}|dr}|d|kr}|j|d�|jd|d�q4d|kr4|jd�|jd�q4q4Wt�}x��dD]r}|dr|d|kr|j|d�|jd|d�q�d|kr�|jd�|jd�q�q�Wn3|dkrj|d�rg|jd�d�n|d�r�|jd�d�n|d	�r�d
}�d	tkr�d|}n|j|�n�dr�t�d�d�\}	}
xO|
D]G}|dr*|jd|d|df�q�|jd|d�q�Wxc|	D]X}|dr�t||d�|jd|d|df�qJ|jd|d�qJWn�dr�t�d�d�\}	}
xO|
D]G}|dr	|jd|d|df�q�|jd|d�q�Wxc|	D]X}|drlt||d�|jd |d|df�q)|jd!|d�q)Wn�drjt�d�d�\}	}
xO|
D]G}|dr�|jd"|d|d#f�q�|jd$|d#�q�Wxc|	D]X}|drKt||d�|jd%|d|d#f�q|jd&|d#�qWqjn|S('Ntstatecs1�j|�dk	o0�j|��j|�kS(N(tgetR(tx(RR(sJ/usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_system.pytneeds_update�stabsentthostnametRoutersno hostnamet
lookup_sources'no ip domain lookup source-interface %stlookup_enabledsip domain lookuptdomain_nameRsno ip domain name vrf %ssno ip domain namet
domain_searchsno ip domain list vrf %ssno ip domain listtname_serverssno ip name-server vrf %ssno ip name-servertpresentshostname %ss$ip domain lookup source-interface %ssno %ssno ip domain name vrf %s %stnamesno ip domain name %ssip domain name vrf %s %ssip domain name %ssno ip domain list vrf %s %ssno ip domain list %ssip domain list vrf %s %ssip domain list %ssno ip name-server vrf %s %stserversno ip name-server %ssip name-server vrf %s %ssip name-server %s(	tlisttparamstappendtFalsetsettaddRRR(RRRtcommandsRR tvrfstitemtcmdRR((RRsJ/usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_system.pytmap_obj_to_commands�s�	

	
	
	




"

"


"

"


"

"cCs%tjd|tj�}|jd�S(Ns^hostname (\S+)i(R
tsearchtMtgroup(Rtmatch((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_system.pytparse_hostname�scCsftjd|tj�}t�}x>|D]6\}}|sCd}n|ji|d6|d6�q(W|S(Ns'^ip domain[- ]name (?:vrf (\S+) )*(\S+)R*R(R
RR8R,RR.(RR:tmatchesRR*((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_system.pytparse_domain_names		cCsftjd|tj�}t�}x>|D]6\}}|sCd}n|ji|d6|d6�q(W|S(Ns'^ip domain[- ]list (?:vrf (\S+) )*(\S+)R*R(R
RR8R,RR.(RR:R<RR*((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_system.pytparse_domain_search
s		cCs}tjd|tj�}t�}xU|D]M\}}|sCd}nx/|j�D]!}|ji|d6|d6�qPWq(W|S(Ns#^ip name-server (?:vrf (\S+) )*(.*)R+R(R
RR8R,RtsplitR.(RR:R<RtserversR+((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_system.pytparse_name_serverss		#cCs/tjd|tj�}|r+|jd�SdS(Ns*ip domain[- ]lookup source-interface (\S+)i(R
R7R8R9(RR:((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_system.pytparse_lookup_sourcescCsjt|�}it|�d6t|�d6t|�d6t|�d6d|koXd|kd6t|�d6S(	NR"R&R'R$sno ip domain lookupsno ip domain-lookupR%R((RR;R=R>RBRA(RR((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_system.pytmap_config_to_obj%s



cCsi|jdd6|jdd6|jdd6}ttdtdt�dt��|�}ttdtdt�dt��|�}ttdtdt�dt��|�}x`d|fd	|fd
|fgD]=\}}|j|r||j|�||<q�d||<q�W|S(NR"R$R%R*tkeyRR+R&R'R((R-R
tdicttTrueR(RtobjR&R'R(targtcast((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_system.pytmap_params_to_obj1s.										
cCs2tdt�dtdd�dtdd�dtdd�dt�dtdd	�d
tddd
gdd��}|jt�td|dt�}itd6}t�}t||�||d<t|�}t	|�}t
|||�}||d<|r!|jst||�nt|d<n|j
|�dS(s3 Main entry point for Ansible module execution
    R"R&ttypeR,R'R(R$R%tboolRtchoicesR)R!tdefaultt
argument_spectsupports_check_modetchangedtwarningsR2N(REtupdateRRRFR/R,R	RJRCR6t
check_modeRt	exit_json(RORtresultRRRRR2((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_system.pytmainSs0		
	
	


	
t__main__(tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR
tansible.module_utils.basicRt$ansible.module_utils.network.ios.iosRRRR	t)ansible.module_utils.network.common.utilsR
RRRRRR6R;R=R>RARBRCRJRWt__name__(((sJ/usr/lib/python2.7/site-packages/ansible/modules/network/ios/ios_system.pyt<module>s2


=
					f		
	
				"	)

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