.. _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 ``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. Requirements ------------ The below requirements are needed on the host that executes this module. - VyOS 1.3+ Parameters ---------- .. raw:: html
Parameter Choices/Defaults Comments
api_key
string / required
API key configured on the device.
config
dictionary
Hostname configuration.
hostname
string / required
System hostname (max 63 characters, no underscores).
hostname
string / required
IP address or FQDN of the VyOS device.
port
integer
Default:
443
HTTPS port for the REST API.
state
string
    Choices:
  • merged ←
  • deleted
  • gathered
merged - Ensure the hostname is set to the value in config.
deleted - Remove the configured hostname (resets to default).
gathered - Read the current hostname from the device and return it in gathered without making changes.
timeout
integer
Default:
30
Request timeout in seconds.
verify_ssl
boolean
    Choices:
  • no ←
  • yes
Validate the device's TLS certificate.

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 register: result - 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
REST API commands dispatched.

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



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