| 1 |
.. _cisco.ios.ios_banner_module: |
| 2 |
|
| 3 |
|
| 4 |
******************** |
| 5 |
cisco.ios.ios_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 will configure both login and motd banners on remote devices running Cisco IOS. It allows playbooks to add or remote banner text from the active running configuration. |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
Parameters |
| 26 |
---------- |
| 27 |
|
| 28 |
.. raw:: html |
| 29 |
|
| 30 |
<table border=0 cellpadding=0 class="documentation-table"> |
| 31 |
<tr> |
| 32 |
<th colspan="1">Parameter</th> |
| 33 |
<th>Choices/<font color="blue">Defaults</font></th> |
| 34 |
<th width="100%">Comments</th> |
| 35 |
</tr> |
| 36 |
<tr> |
| 37 |
<td colspan="1"> |
| 38 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 39 |
<b>banner</b> |
| 40 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 41 |
<div style="font-size: small"> |
| 42 |
<span style="color: purple">string</span> |
| 43 |
/ <span style="color: red">required</span> |
| 44 |
</div> |
| 45 |
</td> |
| 46 |
<td> |
| 47 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 48 |
<li>login</li> |
| 49 |
<li>motd</li> |
| 50 |
<li>exec</li> |
| 51 |
<li>incoming</li> |
| 52 |
<li>slip-ppp</li> |
| 53 |
</ul> |
| 54 |
</td> |
| 55 |
<td> |
| 56 |
<div>Specifies which banner should be configured on the remote device. In Ansible 2.4 and earlier only <em>login</em> and <em>motd</em> were supported.</div> |
| 57 |
</td> |
| 58 |
</tr> |
| 59 |
<tr> |
| 60 |
<td colspan="1"> |
| 61 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 62 |
<b>multiline_delimiter</b> |
| 63 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 64 |
<div style="font-size: small"> |
| 65 |
<span style="color: purple">string</span> |
| 66 |
</div> |
| 67 |
</td> |
| 68 |
<td> |
| 69 |
<b>Default:</b><br/><div style="color: blue">"@"</div> |
| 70 |
</td> |
| 71 |
<td> |
| 72 |
<div>Specify the delimiting character than will be used for configuration.</div> |
| 73 |
</td> |
| 74 |
</tr> |
| 75 |
<tr> |
| 76 |
<td colspan="1"> |
| 77 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 78 |
<b>state</b> |
| 79 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 80 |
<div style="font-size: small"> |
| 81 |
<span style="color: purple">string</span> |
| 82 |
</div> |
| 83 |
</td> |
| 84 |
<td> |
| 85 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 86 |
<li><div style="color: blue"><b>present</b> ←</div></li> |
| 87 |
<li>absent</li> |
| 88 |
</ul> |
| 89 |
</td> |
| 90 |
<td> |
| 91 |
<div>Specifies whether or not the configuration is present in the current devices active running configuration.</div> |
| 92 |
</td> |
| 93 |
</tr> |
| 94 |
<tr> |
| 95 |
<td colspan="1"> |
| 96 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 97 |
<b>text</b> |
| 98 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 99 |
<div style="font-size: small"> |
| 100 |
<span style="color: purple">string</span> |
| 101 |
</div> |
| 102 |
</td> |
| 103 |
<td> |
| 104 |
</td> |
| 105 |
<td> |
| 106 |
<div>The banner text that should be present in the remote device running configuration. This argument accepts a multiline string, with no empty lines. Requires <em>state=present</em>.</div> |
| 107 |
</td> |
| 108 |
</tr> |
| 109 |
</table> |
| 110 |
<br/> |
| 111 |
|
| 112 |
|
| 113 |
Notes |
| 114 |
----- |
| 115 |
|
| 116 |
.. note:: |
| 117 |
- Tested against Cisco IOSXE Version 17.3 on CML. |
| 118 |
- This module works with connection ``network_cli``. See https://docs.ansible.com/ansible/latest/network/user_guide/platform_ios.html |
| 119 |
- For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide <network_guide>` |
| 120 |
- For more information on using Ansible to manage Cisco devices see the `Cisco integration page <https://www.ansible.com/integrations/networks/cisco>`_. |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
Examples |
| 125 |
-------- |
| 126 |
|
| 127 |
.. code-block:: yaml |
| 128 |
|
| 129 |
- name: Configure the login banner |
| 130 |
cisco.ios.ios_banner: |
| 131 |
banner: login |
| 132 |
text: | |
| 133 |
this is my login banner |
| 134 |
that contains a multiline |
| 135 |
string |
| 136 |
state: present |
| 137 |
|
| 138 |
- name: Remove the motd banner |
| 139 |
cisco.ios.ios_banner: |
| 140 |
banner: motd |
| 141 |
state: absent |
| 142 |
|
| 143 |
- name: Configure banner from file |
| 144 |
cisco.ios.ios_banner: |
| 145 |
banner: motd |
| 146 |
text: "{{ lookup('file', './config_partial/raw_banner.cfg') }}" # Use unix formatted text files (LF not CRLF) to avoid idempotency issues. |
| 147 |
state: present |
| 148 |
|
| 149 |
- name: Configure the login banner using delimiter |
| 150 |
cisco.ios.ios_banner: |
| 151 |
banner: login |
| 152 |
multiline_delimiter: x |
| 153 |
text: this is my login banner |
| 154 |
state: present |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
Return Values |
| 159 |
------------- |
| 160 |
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: |
| 161 |
|
| 162 |
.. raw:: html |
| 163 |
|
| 164 |
<table border=0 cellpadding=0 class="documentation-table"> |
| 165 |
<tr> |
| 166 |
<th colspan="1">Key</th> |
| 167 |
<th>Returned</th> |
| 168 |
<th width="100%">Description</th> |
| 169 |
</tr> |
| 170 |
<tr> |
| 171 |
<td colspan="1"> |
| 172 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 173 |
<b>commands</b> |
| 174 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 175 |
<div style="font-size: small"> |
| 176 |
<span style="color: purple">list</span> |
| 177 |
</div> |
| 178 |
</td> |
| 179 |
<td>always</td> |
| 180 |
<td> |
| 181 |
<div>The list of configuration mode commands to send to the device</div> |
| 182 |
<br/> |
| 183 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 184 |
<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> |
| 185 |
</td> |
| 186 |
</tr> |
| 187 |
</table> |
| 188 |
<br/><br/> |
| 189 |
|
| 190 |
|
| 191 |
Status |
| 192 |
------ |
| 193 |
|
| 194 |
|
| 195 |
Authors |
| 196 |
~~~~~~~ |
| 197 |
|
| 198 |
- Ricardo Carrillo Cruz (@rcarrillocruz) |