From c3671c4e3e2ad7efa119982f2ee41334fcacd073 Mon Sep 17 00:00:00 2001 From: omnom62 Date: Wed, 15 Apr 2026 07:24:24 +1000 Subject: Rest API module --- docs/vyos.rest.vyos_banner_module.rst | 56 ++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 11 deletions(-) (limited to 'docs') 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 -
Banner text (supports multiline string).
+
Banner text. Supports multiline strings via YAML block scalar (|).
+
Internally, real newlines are converted to literal \\n as VyOS expects.
@@ -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 when changed -
Configuration after changes.
+
Configuration after changes (text uses real newlines).

+
Sample:
+
{'banner': 'pre-login', 'text': 'New banner text'}
@@ -199,8 +212,10 @@ Common return values are documented `here always -
Configuration before changes.
+
Configuration before changes (text uses real newlines).

+
Sample:
+
{'banner': 'pre-login', 'text': 'Old banner text'}
@@ -214,8 +229,10 @@ Common return values are documented `here when changes are required -
List of commands sent to the device.
+
List of API command dicts sent to the device.

+
Sample:
+
[{'op': 'set', 'path': ['system', 'login', 'banner', 'pre-login'], 'value': 'New banner text'}]
@@ -229,8 +246,10 @@ Common return values are documented `here when state is gathered -
Current device configuration.
+
Current device configuration (text uses real newlines).

+
Sample:
+
{'banner': 'pre-login', 'text': 'Current banner text'}
@@ -248,6 +267,21 @@ Common return values are documented `here + + +
+ saved + +
+ dictionary +
+ + when changes are applied + +
Result of save_config call after applying changes.
+
+ +

-- cgit v1.2.3