From 066ab3c5795cfc30337831708da1a73a449f404f Mon Sep 17 00:00:00 2001 From: omnom62 Date: Tue, 2 Jun 2026 21:11:33 +1000 Subject: Hostname module fixes --- docs/vyos.rest.vyos_banner_module.rst | 16 +++++-- docs/vyos.rest.vyos_hostname_module.rst | 76 +++++++++++++++++++++++++++++++-- 2 files changed, 85 insertions(+), 7 deletions(-) (limited to 'docs') diff --git a/docs/vyos.rest.vyos_banner_module.rst b/docs/vyos.rest.vyos_banner_module.rst index b459bfb..4e0e3ab 100644 --- a/docs/vyos.rest.vyos_banner_module.rst +++ b/docs/vyos.rest.vyos_banner_module.rst @@ -73,7 +73,6 @@ Parameters
string - / required
@@ -157,8 +156,8 @@ Parameters
Desired state of the banner configuration.
merged - set the banner if it differs from the current value.
replaced - replace the banner text unconditionally.
-
deleted - remove the banner.
-
gathered - return the current banner in gathered without making any changes.
+
deleted - remove the banner. If config.banner is omitted, both pre-login and post-login banners are removed.
+
gathered - return the current banner in gathered without making any changes. If config.banner is omitted, all banners are returned.
@@ -231,12 +230,16 @@ Examples text: "Welcome. Authorised access only." state: replaced - - name: Remove pre-login banner + - name: Remove pre-login banner only vyos.rest.vyos_banner: config: banner: pre-login state: deleted + - name: Remove all banners + vyos.rest.vyos_banner: + state: deleted + - name: Read current pre-login banner without changing it vyos.rest.vyos_banner: config: @@ -244,6 +247,11 @@ Examples state: gathered register: result + - name: Read all banners + vyos.rest.vyos_banner: + state: gathered + register: result + - name: Print gathered banner ansible.builtin.debug: msg: "Current banner: {{ result.gathered.text }}" diff --git a/docs/vyos.rest.vyos_hostname_module.rst b/docs/vyos.rest.vyos_hostname_module.rst index b8fb5fd..c8ea1c5 100644 --- a/docs/vyos.rest.vyos_hostname_module.rst +++ b/docs/vyos.rest.vyos_hostname_module.rst @@ -19,6 +19,7 @@ Synopsis -------- - Manages the ``set system host-name`` configuration on a VyOS device using the HTTPS REST API. - Mirrors the behaviour of ``vyos.vyos.vyos_hostname`` but uses the HTTP API instead of SSH/network_cli. +- The states ``replaced``, ``overridden`` behave identically to ``merged`` for this single-value resource. @@ -47,7 +48,6 @@ Parameters
string - / required
@@ -96,13 +96,12 @@ Parameters
string - / required
-
IP address or FQDN of the VyOS device.
+
IP address or FQDN of the VyOS device (not needed with httpapi inventory).
@@ -121,6 +120,22 @@ Parameters
HTTPS port for the REST API.
+ + +
+ running_config + +
+ string +
+ + + + +
Used only with state parsed.
+
The value should be the output of show configuration commands | grep host-name from the device.
+ +
@@ -133,14 +148,22 @@ Parameters
merged - Ensure the hostname is set to the value in config.
+
replaced - Identical to merged for this single-value resource.
+
overridden - Identical to merged for this single-value resource.
deleted - Remove the configured hostname (resets to default).
gathered - Read the current hostname from the device and return it in gathered without making changes.
+
rendered - Return the CLI commands for the given config without connecting to the device.
+
parsed - Parse the running_config string and return structured data without connecting to the device.
@@ -203,6 +226,12 @@ Examples hostname: vyos-core-01 state: merged + - name: Replace hostname + vyos.rest.vyos_hostname: + config: + hostname: vyos-core-02 + state: replaced + - name: Gather current hostname vyos.rest.vyos_hostname: state: gathered @@ -212,6 +241,17 @@ Examples vyos.rest.vyos_hostname: state: deleted + - name: Render commands without connecting + vyos.rest.vyos_hostname: + config: + hostname: vyos-core-01 + state: rendered + + - name: Parse running config + vyos.rest.vyos_hostname: + running_config: "set system host-name 'vyos'" + state: parsed + Return Values @@ -286,6 +326,36 @@ Common return values are documented `here + + +
+ parsed + +
+ dictionary +
+ + when state is parsed + +
Structured data parsed from running_config (state=parsed only).
+
+ + + + +
+ rendered + +
+ list +
+ + when state is rendered + +
CLI commands for the provided config (state=rendered only).
+
+ +

-- cgit v1.2.3