Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/iosxr/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pyc

�
�Udac@`s1ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZmZddlmZddlmZmZddlmZmZdefd��YZdefd��YZdefd��YZd�Zedkr-e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys}
---
module: iosxr_banner
version_added: "2.4"
author:
    - Trishna Guha (@trishnaguha)
    - Kedar Kekan (@kedarX)
short_description: Manage multiline banners on Cisco IOS XR devices
description:
  - This module will configure both exec and motd banners on remote device
    running Cisco IOS XR. It allows playbooks to add or remove
    banner text from the running configuration.
requirements:
    - ncclient >= 0.5.3 when using netconf
    - lxml >= 4.1.1 when using netconf
extends_documentation_fragment: iosxr
notes:
  - Tested against IOS XRv 6.1.3.
  - This module works with connection C(network_cli) and C(netconf). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html).
options:
  banner:
    description:
      - Specifies the type of banner to configure on remote device.
    required: true
    choices: ['login', 'motd']
  text:
    description:
      - Banner text to be configured. Accepts multiline string,
        without empty lines. Requires I(state=present).
  state:
    description:
      - Existential state of the configuration on the device.
    default: present
    choices: ['present', 'absent']
s�
- name: configure the login banner
  iosxr_banner:
    banner: login
    text: |
      this is my login banner
      that contains a multiline
      string
    state: present
- name: remove the motd banner
  iosxr_banner:
    banner: motd
    state: absent
- name: Configure banner from file
  iosxr_banner:
    banner:  motd
    text: "{{ lookup('file', './config_partial/raw_banner.cfg') }}"
    state: present
sF
commands:
  description: The list of configuration mode commands sent to device with transport C(cli)
  returned: always (empty list when no commands to send)
  type: list
  sample:
    - banner login
    - this is my login banner
    - that contains a multiline
    - string

xml:
  description: NetConf rpc xml sent to device with transport C(netconf)
  returned: always (empty list when no xml rpc to send)
  type: list
  version_added: 2.5
  sample:
    - '<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
            <banners xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-infra-infra-cfg">
                <banner xc:operation="merge">
                  <banner-name>motd</banner-name>
                  <banner-text>Ansible banner example</banner-text>
                </banner>
            </banners>
        </config>'
N(t
AnsibleModule(t
get_configtload_config(tiosxr_argument_spec(t	build_xmlt
is_cliconf(t
etree_findt
is_netconft
ConfigBasecB`seZd�Zd�ZRS(cC`s6||_itd6gd6|_i|_i|_dS(Ntchangedtwarnings(t_moduletFalset_resultt_wantt_have(tselftmodule((sN/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pyt__init__ms		cC`sq|jjd}|r4djt|�j��}n|jji|jjdd6|d6|jjdd6�dS(Nttexts{0!r}tbannertstate(RtparamstformattstrtstripRtupdate(RR((sN/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pytmap_params_to_objss(t__name__t
__module__RR#(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pyRls	tCliConfigurationcB`s,eZd�Zd�Zd�Zd�ZRS(cC`stt|�j|�dS(N(tsuperR&R(RR((sN/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pyRscC`s�t�}|jjd}|dkr�|jjd�dkrd|jj�kr|jdr|jdj|jjd��qn�|dkr|jdr|jdj	�j
d�jd�|jjd�krd	j|jjd�}||jdj�7}|j|�qn||jd
<|r|jj
}t|j|d|�}|rotd|�|jd
<nt|jd<ndS(NRtabsentRsno banner {0!s}Rtpresenttunicode_escapet's
banner {0!s} tcommandstcommittpreparedtdiffR(tlistRRRtgettkeystappendRRtencodetdecodeR!Rt
check_modeR
tdicttTrue(RR,Rt
banner_cmdR-R/((sN/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pytmap_obj_to_commands�s$	:&
7

cC`s�dj|jjd�}t|jd|�}tjd|tj�}|rg|jd�jd�}nd}i|jjdd6dd6}|r�||d	<d
|d<n|j
j|�dS(Nsbanner {0!s}Rt
config_filtersbanner (\S+) (.*)iR+R(RRR)(RRRR	tretsearchtDOTALLtgroupR!tNoneRR"(Rt
cli_filtertoutputtmatchRtobj((sN/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pytmap_config_to_obj�s

cC`s%|j�|j�|j�|jS(N(R#RER:R(R((sN/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pytrun�s


(R$R%RR:RERF(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pyR&~s			tNCConfigurationcB`s#eZd�Zd�Zd�ZRS(cC`s~tt|�j|�tj�|_|jjdidd6td6dd6fdidd6fd	id
d6dd6fg�dS(NRsbanners/bannertxpathttagt	operationtattribsa:bannersbanner/banner-namesa:textsbanner/banner-texttedit(R'RGRtcollectionstOrderedDictt
_banners_metaR"R8(RR((sN/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pyR�s	c
C`s�|jjd}tdd|jd|jjdd�}t|jddd	|�}d}d}t|d
�dk	r�t|d�j}t|d
�j}nd}|dkr�||jjd
kr�t|�r�d}n|dkr�d}ng|j	d<|r�tdd|jd|jjd|�}|dk	r�|jj
}t|j|d|d|d|�}	|	r�||j	d<|jjr�t
d|	�|j	d<nt|j	d<q�q�ndS(NRtbannerstxmapRtopcodetfiltertsourcetrunningR;sbanner-textsbanner-nameR(RtdeleteR)tmergetxmlR-t
nc_get_filterR.R/R(RRRROR	R@RRtlenRR6R
t_diffR7R8(
RRt_get_filterRUtbanner_nametbanner_textRRt_edit_filterR-R/((sN/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pytmap_obj_to_xml_rpc�s0'.		
'
$
cC`s|j�|j�|jS(N(R#R`R(R((sN/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pyRF�s

(R$R%RR`RF(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pyRG�s			!cC`s�tdtdtdddg�dt�dtdd	dd	d
g��}|jt�dd	dfg}td|d|d
t�}d}t|�r�t|�}nt|�r�t	|�}nd}|dk	r�|j
�}n|j|�dS(s+ main entry point for module execution
    RtrequiredtchoicestlogintmotdRRtdefaultR)R(t
argument_spectrequired_iftsupports_check_modeN(R(R7R8R"RRR@R
R&RRGRFt	exit_json(RfRgRt
config_objecttresult((sN/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pytmain�s$	
	t__main__(t
__future__RRRttypet
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR<RMtansible.module_utils.basicRt(ansible.module_utils.network.iosxr.iosxrR	R
RRR
RRtobjectRR&RGRlR$(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pyt<module>s(


$.2	 

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