.. _vyos.rest.vyos_hostname_module: *********************** vyos.rest.vyos_hostname *********************** **Manage the system hostname on a VyOS device via the REST API.** Version added: 1.0.0 .. contents:: :local: :depth: 1 Synopsis -------- - Manages the ``system host-name`` configuration on a VyOS device using the HTTPS REST API. Parameters ---------- .. raw:: html
Parameter Choices/Defaults Comments
config
dictionary
Hostname configuration.
hostname
string / required
System hostname (max 63 characters, no underscores).
state
string
    Choices:
  • merged ←
  • replaced
  • overridden
  • deleted
  • gathered
merged - Ensure the hostname is set to the value in config.
replaced and overridden behave identically to merged for this single-value resource -- there is nothing else to distinctly replace or override when there is only one field.
deleted - Remove the configured hostname.
gathered - Read the current hostname from the device without making changes.

See Also -------- .. seealso:: :ref:`vyos.vyos.vyos_hostname_module` The official documentation on the **vyos.vyos.vyos_hostname** module. Examples -------- .. code-block:: yaml - name: Set hostname vyos.rest.vyos_hostname: config: hostname: vyos-core-01 state: merged - name: Gather current hostname vyos.rest.vyos_hostname: state: gathered - name: Delete hostname configuration vyos.rest.vyos_hostname: state: deleted 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
Configuration on the device after the module ran.

before
dictionary
always
Configuration on the device before the module ran.

commands
list
always
List of API command tuples sent to the device.

gathered
dictionary
when state is gathered
Hostname read from the device (state=gathered only).

response
dictionary
when changes are applied
Raw API response.

saved
boolean
when changes are applied
Whether the config was saved after changes.



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