| 1 |
.. _cisco.iosxr.iosxr_banner_module: |
| 2 |
|
| 3 |
|
| 4 |
************************ |
| 5 |
cisco.iosxr.iosxr_banner |
| 6 |
************************ |
| 7 |
|
| 8 |
**Module to configure multiline banners.** |
| 9 |
|
| 10 |
|
| 11 |
Version added: 1.0.0 |
| 12 |
|
| 13 |
.. contents:: |
| 14 |
:local: |
| 15 |
:depth: 1 |
| 16 |
|
| 17 |
|
| 18 |
Synopsis |
| 19 |
-------- |
| 20 |
- 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. |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
Requirements |
| 25 |
------------ |
| 26 |
The below requirements are needed on the host that executes this module. |
| 27 |
|
| 28 |
- ncclient >= 0.5.3 when using netconf |
| 29 |
- lxml >= 4.1.1 when using netconf |
| 30 |
|
| 31 |
|
| 32 |
Parameters |
| 33 |
---------- |
| 34 |
|
| 35 |
.. raw:: html |
| 36 |
|
| 37 |
<table border=0 cellpadding=0 class="documentation-table"> |
| 38 |
<tr> |
| 39 |
<th colspan="1">Parameter</th> |
| 40 |
<th>Choices/<font color="blue">Defaults</font></th> |
| 41 |
<th width="100%">Comments</th> |
| 42 |
</tr> |
| 43 |
<tr> |
| 44 |
<td colspan="1"> |
| 45 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 46 |
<b>banner</b> |
| 47 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 48 |
<div style="font-size: small"> |
| 49 |
<span style="color: purple">string</span> |
| 50 |
/ <span style="color: red">required</span> |
| 51 |
</div> |
| 52 |
</td> |
| 53 |
<td> |
| 54 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 55 |
<li>login</li> |
| 56 |
<li>motd</li> |
| 57 |
</ul> |
| 58 |
</td> |
| 59 |
<td> |
| 60 |
<div>Specifies the type of banner to configure on remote device.</div> |
| 61 |
</td> |
| 62 |
</tr> |
| 63 |
<tr> |
| 64 |
<td colspan="1"> |
| 65 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 66 |
<b>state</b> |
| 67 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 68 |
<div style="font-size: small"> |
| 69 |
<span style="color: purple">string</span> |
| 70 |
</div> |
| 71 |
</td> |
| 72 |
<td> |
| 73 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 74 |
<li><div style="color: blue"><b>present</b> ←</div></li> |
| 75 |
<li>absent</li> |
| 76 |
</ul> |
| 77 |
</td> |
| 78 |
<td> |
| 79 |
<div>Existential state of the configuration on the device.</div> |
| 80 |
</td> |
| 81 |
</tr> |
| 82 |
<tr> |
| 83 |
<td colspan="1"> |
| 84 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 85 |
<b>text</b> |
| 86 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 87 |
<div style="font-size: small"> |
| 88 |
<span style="color: purple">string</span> |
| 89 |
</div> |
| 90 |
</td> |
| 91 |
<td> |
| 92 |
</td> |
| 93 |
<td> |
| 94 |
<div>Banner text to be configured. Accepts multi line string, without empty lines. When using a multi line string, the first and last characters must be the start and end delimiters for the banner Requires <em>state=present</em>.</div> |
| 95 |
</td> |
| 96 |
</tr> |
| 97 |
</table> |
| 98 |
<br/> |
| 99 |
|
| 100 |
|
| 101 |
Notes |
| 102 |
----- |
| 103 |
|
| 104 |
.. note:: |
| 105 |
- This module works with connection ``network_cli`` and ``netconf``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. |
| 106 |
- For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide <network_guide>` |
| 107 |
- For more information on using Ansible to manage Cisco devices see the `Cisco integration page <https://www.ansible.com/integrations/networks/cisco>`_. |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
Examples |
| 112 |
-------- |
| 113 |
|
| 114 |
.. code-block:: yaml |
| 115 |
|
| 116 |
- name: configure the login banner |
| 117 |
cisco.iosxr.iosxr_banner: |
| 118 |
banner: login |
| 119 |
text: | |
| 120 |
@this is my login banner |
| 121 |
that contains a multiline |
| 122 |
string@ |
| 123 |
state: present |
| 124 |
- name: remove the motd banner |
| 125 |
cisco.iosxr.iosxr_banner: |
| 126 |
banner: motd |
| 127 |
state: absent |
| 128 |
- name: Configure banner from file |
| 129 |
cisco.iosxr.iosxr_banner: |
| 130 |
banner: motd |
| 131 |
text: '{{ lookup(''file'', ''./config_partial/raw_banner.cfg'') }}' |
| 132 |
state: present |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
Return Values |
| 137 |
------------- |
| 138 |
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module: |
| 139 |
|
| 140 |
.. raw:: html |
| 141 |
|
| 142 |
<table border=0 cellpadding=0 class="documentation-table"> |
| 143 |
<tr> |
| 144 |
<th colspan="1">Key</th> |
| 145 |
<th>Returned</th> |
| 146 |
<th width="100%">Description</th> |
| 147 |
</tr> |
| 148 |
<tr> |
| 149 |
<td colspan="1"> |
| 150 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 151 |
<b>commands</b> |
| 152 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 153 |
<div style="font-size: small"> |
| 154 |
<span style="color: purple">list</span> |
| 155 |
</div> |
| 156 |
</td> |
| 157 |
<td>always (empty list when no commands to send)</td> |
| 158 |
<td> |
| 159 |
<div>The list of configuration mode commands sent to device with transport <code>cli</code></div> |
| 160 |
<br/> |
| 161 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 162 |
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['banner login', '@this is my login banner', 'that contains a multiline', 'string@']</div> |
| 163 |
</td> |
| 164 |
</tr> |
| 165 |
<tr> |
| 166 |
<td colspan="1"> |
| 167 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 168 |
<b>xml</b> |
| 169 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 170 |
<div style="font-size: small"> |
| 171 |
<span style="color: purple">list</span> |
| 172 |
</div> |
| 173 |
</td> |
| 174 |
<td>always (empty list when no xml rpc to send)</td> |
| 175 |
<td> |
| 176 |
<div>NetConf rpc xml sent to device with transport <code>netconf</code></div> |
| 177 |
<br/> |
| 178 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 179 |
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['<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>']</div> |
| 180 |
</td> |
| 181 |
</tr> |
| 182 |
</table> |
| 183 |
<br/><br/> |
| 184 |
|
| 185 |
|
| 186 |
Status |
| 187 |
------ |
| 188 |
|
| 189 |
|
| 190 |
Authors |
| 191 |
~~~~~~~ |
| 192 |
|
| 193 |
- Trishna Guha (@trishnaguha) |
| 194 |
- Kedar Kekan (@kedarX) |