�
�Udac @` s1 d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l Z d d l m
Z
d d
l m Z m Z d d l m Z d d l m Z m Z d d l m Z m Z d e f d � � YZ d e f d � � YZ d e f d � � YZ d � Z e d k r-e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust networkt 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_configt load_config( t iosxr_argument_spec( t build_xmlt
is_cliconf( t
etree_findt
is_netconft
ConfigBasec B` s e Z d � Z d � Z RS( c C` s6 | | _ i t d 6g d 6| _ i | _ i | _ d S( Nt changedt warnings( t _modulet Falset _resultt _wantt _have( t selft module( ( sN /usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pyt __init__m s c C` sq | j j d } | r4 d j t | � j � � } n | j j i | j j d d 6| d 6| j j d d 6� d S( Nt texts {0!r}t bannert state( R t paramst formatt strt stripR t update( R R ( ( sN /usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pyt map_params_to_objs s ( t __name__t
__module__R R# ( ( ( sN /usr/lib/python2.7/site-packages/ansible/modules/network/iosxr/iosxr_banner.pyR l s t CliConfigurationc B` s, e Z d � Z d � Z d � Z d � Z RS( c C` s t t | � j | � d S( N( t superR&