Anons79 Mini Shell

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

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddlmZddlmZmZmZdZe
jd�gZd�Zd�Zd�Zd�Zd�Zd�Zedkre�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys
---
module: edgeos_config
version_added: "2.5"
author:
    - "Nathaniel Case (@Qalthos)"
    - "Sam Doran (@samdoran)"
short_description: Manage EdgeOS configuration on remote device
description:
  - This module provides configuration file management of EdgeOS
    devices. It provides arguments for managing both the
    configuration file and state of the active configuration. All
    configuration statements are based on `set` and `delete` commands
    in the device configuration.
  - "This is a network module and requires the C(connection: network_cli) in order
    to work properly."
  - For more information please see the L(Network Guide,../network/getting_started/index.html).
notes:
  - Tested against EdgeOS 1.9.7
  - Setting C(ANSIBLE_PERSISTENT_COMMAND_TIMEOUT) to 30 is recommended since
    the save command can take longer than the default of 10 seconds on
    some EdgeOS hardware.
options:
  lines:
    description:
      - The ordered set of configuration lines to be managed and
        compared with the existing configuration on the remote
        device.
  src:
    description:
      - The C(src) argument specifies the path to the source config
        file to load. The source config file can either be in
        bracket format or set format. The source file can include
        Jinja2 template variables.
  match:
    description:
      - The C(match) argument controls the method used to match
        against the current active configuration. By default, the
        desired config is matched against the active config and the
        deltas are loaded. If the C(match) argument is set to C(none)
        the active configuration is ignored and the configuration is
        always loaded.
    default: line
    choices: ['line', 'none']
  backup:
    description:
      - The C(backup) argument will backup the current device's active
        configuration to the Ansible control host prior to making any
        changes. If the C(backup_options) value is not given, the backup
        file will be located in the backup folder in the playbook root
        directory or role root directory if the playbook is part of an
        ansible role. If the directory does not exist, it is created.
    type: bool
    default: 'no'
  comment:
    description:
      - Allows a commit description to be specified to be included
        when the configuration is committed. If the configuration is
        not changed or committed, this argument is ignored.
    default: 'configured by edgeos_config'
  config:
    description:
      - The C(config) argument specifies the base configuration to use
        to compare against the desired configuration. If this value
        is not specified, the module will automatically retrieve the
        current active configuration from the remote device.
  save:
    description:
      - The C(save) argument controls whether or not changes made
        to the active configuration are saved to disk. This is
        independent of committing the config. When set to C(True), the
        active configuration is saved.
    type: bool
    default: 'no'
  backup_options:
    description:
      - This is a dict object containing configurable options related to backup file path.
        The value of this option is read only when C(backup) is set to I(yes), if C(backup) is set
        to I(no) this option will be silently ignored.
    suboptions:
      filename:
        description:
          - The filename to be used to store the backup configuration. If the the filename
            is not given it will be generated based on the hostname, current time and date
            in format defined by <hostname>_config.<current-date>@<current-time>
      dir_path:
        description:
          - This option provides the path ending with directory name in which the backup
            configuration file will be stored. If the directory does not exist it will be first
            created and the filename is either the value of C(filename) or default filename
            as described in C(filename) options description. If the path value is not given
            in that case a I(backup) directory will be created in the current working directory
            and backup configuration will be copied in C(filename) within I(backup) directory.
        type: path
    type: dict
    version_added: "2.8"
s�
- name: configure the remote device
  edgeos_config:
    lines:
      - set system host-name {{ inventory_hostname }}
      - set service lldp
      - delete service dhcp-server

- name: backup and load from file
  edgeos_config:
    src: edgeos.cfg
    backup: yes

- name: configurable backup path
  edgeos_config:
    src: edgeos.cfg
    backup: yes
    backup_options:
      filename: backup.cfg
      dir_path: /home/user
s�
commands:
  description: The list of configuration commands sent to the device
  returned: always
  type: list
  sample: ['...', '...']
filtered:
  description: The list of configuration commands removed to avoid a load failure
  returned: always
  type: list
  sample: ['...', '...']
backup_path:
  description: The full path to the backup file
  returned: when backup is yes
  type: str
  sample: /playbooks/ansible/backup/edgeos_config.2016-07-16@22:28:34
N(t	to_native(t
AnsibleModule(t
NetworkConfig(tload_configt
get_configtrun_commandssconfigured by edgeos_configs;set system login user \S+ authentication encrypted-passwordc	C`s�|jd�p|jd�}tddd|�}|s�g|jD]}|j^qC}t�}xR|D]J}x4t|�D]&\}}|j|�r{||=Pq{q{W|j|�qhWg|D]}d|jdd�^q�}nt|�j	d	�}|S(
Ntsettdeletetindentitcontentssset %ss {ts
(
t
startswithR
titemstlinetlistt	enumeratetappendtreplaceRtsplit(	tconfigt
set_formatt	candidatetctcommandstitemtindextentrytcmd((sP/usr/lib/python2.7/site-packages/ansible/modules/network/edgeos/edgeos_config.pytconfig_to_commands�s	
,cC`sC|jdp|jd}|jdr9dj|�}nt|�S(Ntsrctliness
(tparamstjoinR$(tmoduleR((sP/usr/lib/python2.7/site-packages/ansible/modules/network/edgeos/edgeos_config.pyt
get_candidate�s
c
C`s�g|j�D]}t|�jdd�^q
}t�}t�}g|D]}|jd�rJ|^qJ}xN|D]F}t|�jdd�}|jd�r�|jd�r�td��qr|jd�r2||kr�|j|�q�tj	dd|�}x�|D]%}|j|�r|j|�qqWqr|jd�rr|sW|j|�q�tj	dd|�}xI|D]>}	|	j|�rs||krs|j|�|j
|�qsqsWqrqrWt|�S(Nt'RRRs-line must start with either `set` or `delete`(t
splitlinesRRRRRt
ValueErrorRtretsubtadd(
RRRtupdatestvisitedRtdelete_commandsR tditemR"((sP/usr/lib/python2.7/site-packages/ansible/modules/network/edgeos/edgeos_config.pytdiff_config�s01		(
 


cC`sut�|d<xatD]Y}xPttt|���D]6\}}|j|�r3|dj|�||=q3q3WqWdS(Ntfiltered(RtCONFIG_FILTERStreversedRtsearchR(RtresulttregexR!R((sP/usr/lib/python2.7/site-packages/ansible/modules/network/edgeos/edgeos_config.pytsanitize_config�s

%cC`s�|jdpt|�}t|�}t||�}t||�||d<|j}|jd}|r�t||d|d|�|jd�r�|djd�nt	|d<ndS(	NRRtcommenttcommitR6twarningssESome configuration commands were removed, please see the filtered keytchanged(
R'RR*R5R<t
check_modeRtgetRtTrue(R)R:RRRR>R=((sP/usr/lib/python2.7/site-packages/ansible/modules/network/edgeos/edgeos_config.pytrun�s



cC`s�tdt�dtdd��}tdtdd�dtdd�dtd	d
dd
dg�d
td	t�dt�dtddd	t�dtddd|�dtddd	t��}d"g}td|d|dt�}t�}tdtd|�}|jdrtd|�|d<nt|jd|jdf�rOt	||�n|jdr�t
|dddg�d}|d kr�t
|ddg�t|d<nt
|dd!g�n|j|�dS(#Ntfilenametdir_pathttypetpathR%R&RtmatchtdefaultRtchoicestnoneR=Rtbackuptbooltbackup_optionstdicttoptionstsavet
argument_spectmutually_exclusivetsupports_check_modeR@R?R)t
__backup__Rt	configures
compare savedis[edit]texit(R&R%(RPtDEFAULT_COMMENTtFalseR	RCRR'RtanyRDR
t	exit_json(tbackup_spectspecRTR)R?R:tdiff((sP/usr/lib/python2.7/site-packages/ansible/modules/network/edgeos/edgeos_config.pytmains<					
 

t__main__(t
__future__RRRRGt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR.tansible.module_utils._textRtansible.module_utils.basicR	t*ansible.module_utils.network.common.configR
t*ansible.module_utils.network.edgeos.edgeosRRR
RYtcompileR7R$R*R5R<RDR`t__name__(((sP/usr/lib/python2.7/site-packages/ansible/modules/network/edgeos/edgeos_config.pyt<module>s,


b				'				1

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