diff options
| author | omnom62 <omnom62@outlook.com> | 2026-05-06 08:08:49 +1000 |
|---|---|---|
| committer | omnom62 <omnom62@outlook.com> | 2026-05-06 08:08:49 +1000 |
| commit | 1f338c3ef0e7af77bfc93f1b3f54584caa821124 (patch) | |
| tree | 3b95e47254f4d19470698208f5839d182e54238d /docs/vyos.rest.vyos_banner_module.rst | |
| parent | 9a3fa5777e7203d46faf1185cfb56c4fc121d885 (diff) | |
| download | rest.vyos-1f338c3ef0e7af77bfc93f1b3f54584caa821124.tar.gz rest.vyos-1f338c3ef0e7af77bfc93f1b3f54584caa821124.zip | |
more modules
Diffstat (limited to 'docs/vyos.rest.vyos_banner_module.rst')
| -rw-r--r-- | docs/vyos.rest.vyos_banner_module.rst | 340 |
1 files changed, 340 insertions, 0 deletions
diff --git a/docs/vyos.rest.vyos_banner_module.rst b/docs/vyos.rest.vyos_banner_module.rst new file mode 100644 index 0000000..b459bfb --- /dev/null +++ b/docs/vyos.rest.vyos_banner_module.rst @@ -0,0 +1,340 @@ +.. _vyos.rest.vyos_banner_module: + + +********************* +vyos.rest.vyos_banner +********************* + +**Manage multiline banners on VyOS devices via REST API.** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Manages pre-login and post-login banners on VyOS devices using the HTTPS REST API. +- Works with ``ansible_connection=ansible.netcommon.httpapi`` (recommended) or with direct ``hostname``/``api_key`` task parameters. +- VyOS stores banner newlines as literal ``\n`` in its config; this module handles that conversion automatically. + + + + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>api_key</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>REST API key (not needed when ansible_httpapi_api_key is set).</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>config</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Banner configuration.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>banner</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>pre-login</li> + <li>post-login</li> + </ul> + </td> + <td> + <div>Which banner to configure.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>text</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The banner text. Required when <em>state=merged</em> or <em>state=replaced</em>.</div> + <div>Use a YAML block scalar (<code>|</code>) for multi-line banners.</div> + <div>Real newline characters are converted to the <code>\n</code> escape sequence that VyOS stores internally; this is transparent to the user.</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>hostname</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Device IP or FQDN (not needed with httpapi inventory).</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>port</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">443</div> + </td> + <td> + <div>HTTPS port (local mode only).</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>merged</b> ←</div></li> + <li>replaced</li> + <li>deleted</li> + <li>gathered</li> + </ul> + </td> + <td> + <div>Desired state of the banner configuration.</div> + <div><code>merged</code> - set the banner if it differs from the current value.</div> + <div><code>replaced</code> - replace the banner text unconditionally.</div> + <div><code>deleted</code> - remove the banner.</div> + <div><code>gathered</code> - return the current banner in <em>gathered</em> without making any changes.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>timeout</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">30</div> + </td> + <td> + <div>Request timeout in seconds.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>verify_ssl</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div>Validate the device TLS certificate.</div> + </td> + </tr> + </table> + <br/> + + + +See Also +-------- + +.. seealso:: + + :ref:`vyos.vyos.vyos_banner_module` + The official documentation on the **vyos.vyos.vyos_banner** module. + + +Examples +-------- + +.. code-block:: yaml + + - name: Set pre-login banner (merged — only changes if different) + vyos.rest.vyos_banner: + config: + banner: pre-login + text: | + Junk pre-login banner + over multiple lines + state: merged + + - name: Replace post-login banner unconditionally + vyos.rest.vyos_banner: + config: + banner: post-login + text: "Welcome. Authorised access only." + state: replaced + + - name: Remove pre-login banner + vyos.rest.vyos_banner: + config: + banner: pre-login + state: deleted + + - name: Read current pre-login banner without changing it + vyos.rest.vyos_banner: + config: + banner: pre-login + state: gathered + register: result + + - name: Print gathered banner + ansible.builtin.debug: + msg: "Current banner: {{ result.gathered.text }}" + + + +Return Values +------------- +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: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>after</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>when changed</td> + <td> + <div>Banner configuration after the module ran.</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>before</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>always</td> + <td> + <div>Banner configuration before the module ran.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">{'banner': 'pre-login', 'text': 'Old banner text\nline two\n'}</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>commands</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>always</td> + <td> + <div>Configuration commands issued.</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>gathered</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>when state is gathered</td> + <td> + <div>Current banner configuration read from the device (state=gathered).</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">{'banner': 'pre-login', 'text': 'Current banner\nline two\n'}</div> + </td> + </tr> + </table> + <br/><br/> + + +Status +------ + + +Authors +~~~~~~~ + +- VyOS Community (@vyos) |
