diff options
| author | omnom62 <omnom62@outlook.com> | 2026-04-15 07:24:24 +1000 |
|---|---|---|
| committer | omnom62 <omnom62@outlook.com> | 2026-04-15 07:24:24 +1000 |
| commit | c3671c4e3e2ad7efa119982f2ee41334fcacd073 (patch) | |
| tree | 0084638d1b9f71b6be671324779238439f9da5d6 /docs | |
| parent | c9e5c5f6d91bae587a6ce8b7f055b0d068129fe2 (diff) | |
| download | rest.vyos-c3671c4e3e2ad7efa119982f2ee41334fcacd073.tar.gz rest.vyos-c3671c4e3e2ad7efa119982f2ee41334fcacd073.zip | |
Rest API module
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/vyos.rest.vyos_banner_module.rst | 56 |
1 files changed, 45 insertions, 11 deletions
diff --git a/docs/vyos.rest.vyos_banner_module.rst b/docs/vyos.rest.vyos_banner_module.rst index f09f98b..7e7b285 100644 --- a/docs/vyos.rest.vyos_banner_module.rst +++ b/docs/vyos.rest.vyos_banner_module.rst @@ -19,8 +19,9 @@ Synopsis -------- - Configure pre-login and post-login banners on VyOS devices via REST API. - Supports idempotent configuration using structured data. -- Multiline banner text is supported. +- Multiline banner text is supported via YAML block scalars. - Uses REST API (``connection=httpapi``) instead of CLI. +- VyOS stores multiline banners as a single string with literal ``\\n`` separators. @@ -86,7 +87,8 @@ Parameters <td> </td> <td> - <div>Banner text (supports multiline string).</div> + <div>Banner text. Supports multiline strings via YAML block scalar (|).</div> + <div>Internally, real newlines are converted to literal <code>\\n</code> as VyOS expects.</div> </td> </tr> @@ -122,6 +124,8 @@ Notes .. note:: - This module requires ``ansible_connection=httpapi``. - Banner text comparison is whitespace-normalized for idempotency. + - VyOS stores banner text as a leaf string value with literal ``\\n`` for newlines. + - For ``merged``, ``replaced``, and ``overridden`` states, the behaviour is identical for this single-leaf resource — the banner value is set to the desired text. @@ -130,21 +134,28 @@ Examples .. code-block:: yaml - - name: Configure pre-login banner + - name: Configure single-line pre-login banner vyos.rest.vyos_banner: config: banner: pre-login - text: | - Unauthorized access is prohibited - Disconnect immediately + text: "Unauthorized access is prohibited" state: merged - - name: Replace post-login banner + - name: Configure multiline post-login banner vyos.rest.vyos_banner: config: banner: post-login text: | Welcome to VyOS + Authorized users only + Disconnect if you are not authorized + state: merged + + - name: Replace post-login banner + vyos.rest.vyos_banner: + config: + banner: post-login + text: "Welcome to VyOS" state: replaced - name: Remove pre-login banner @@ -184,8 +195,10 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late </td> <td>when changed</td> <td> - <div>Configuration after changes.</div> + <div>Configuration after changes (text uses real newlines).</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': 'New banner text'}</div> </td> </tr> <tr> @@ -199,8 +212,10 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late </td> <td>always</td> <td> - <div>Configuration before changes.</div> + <div>Configuration before changes (text uses real newlines).</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'}</div> </td> </tr> <tr> @@ -214,8 +229,10 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late </td> <td>when changes are required</td> <td> - <div>List of commands sent to the device.</div> + <div>List of API command dicts sent to the device.</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;">[{'op': 'set', 'path': ['system', 'login', 'banner', 'pre-login'], 'value': 'New banner text'}]</div> </td> </tr> <tr> @@ -229,8 +246,10 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late </td> <td>when state is gathered</td> <td> - <div>Current device configuration.</div> + <div>Current device configuration (text uses real newlines).</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 text'}</div> </td> </tr> <tr> @@ -248,6 +267,21 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <br/> </td> </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>saved</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 changes are applied</td> + <td> + <div>Result of save_config call after applying changes.</div> + <br/> + </td> + </tr> </table> <br/><br/> |
