.. _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
Parameter Choices/Defaults Comments
api_key
string
REST API key (not needed when ansible_httpapi_api_key is set).
config
dictionary
Banner configuration.
banner
string
    Choices:
  • pre-login
  • post-login
Which banner to configure.
text
string
The banner text. Required when state=merged or state=replaced.
Use a YAML block scalar (|) for multi-line banners.
Real newline characters are converted to the \n escape sequence that VyOS stores internally; this is transparent to the user.
hostname
string
Device IP or FQDN (not needed with httpapi inventory).
port
integer
Default:
443
HTTPS port (local mode only).
state
string
    Choices:
  • merged ←
  • replaced
  • deleted
  • gathered
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. 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.
timeout
integer
Default:
30
Request timeout in seconds.
verify_ssl
boolean
    Choices:
  • no ←
  • yes
Validate the device TLS certificate.

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 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: banner: pre-login 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 }}" Return Values ------------- Common return values are documented `here `_, the following are the fields unique to this module: .. raw:: html
Key Returned Description
after
dictionary
when changed
Banner configuration after the module ran.

before
dictionary
always
Banner configuration before the module ran.

Sample:
{'banner': 'pre-login', 'text': 'Old banner text\nline two\n'}
commands
list
always
Configuration commands issued.

gathered
dictionary
when state is gathered
Current banner configuration read from the device (state=gathered).

Sample:
{'banner': 'pre-login', 'text': 'Current banner\nline two\n'}


Status ------ Authors ~~~~~~~ - VyOS Community (@vyos)