Skip to content

hostname

Manages the system static hostname. The declaration name IS the desired hostname. Idempotent: re-applying when the static hostname already matches reports no change.

Category: System & core

States

StateMeaning
presentThe system static hostname equals the declaration name.

Parameters

ParameterTypeRequiredDescription
severitystringOverrides the reported drift severity (defaults to medium for this module).

Examples

Set a short hostname

hostname:
  web-1:
    state: present

Set a fully-qualified hostname

The declaration name carries the desired value, including any FQDN.

hostname:
  web1.us-east.internal:
    state: present

Notes

  • The declaration name is the desired hostname; there are no parameters beyond severity.
  • Linux is fully supported: hostnamectl is used when present (handling dbus / SELinux), otherwise the module writes /etc/hostname and execs hostname(1). Non-Linux returns ErrUnsupportedOS.
  • v0.1 out of scope: pretty hostname (/etc/machine-info), transient-only mode, divergent running-vs-static repair, and macOS.