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
| State | Meaning |
|---|---|
present | The system static hostname equals the declaration name. |
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
severity | string | Overrides the reported drift severity (defaults to medium for this module). |
Examples
Set a short hostname
hostname:
web-1:
state: presentSet a fully-qualified hostname
The declaration name carries the desired value, including any FQDN.
hostname:
web1.us-east.internal:
state: presentNotes
- The declaration name is the desired hostname; there are no parameters beyond
severity. - Linux is fully supported:
hostnamectlis used when present (handling dbus / SELinux), otherwise the module writes/etc/hostnameand execshostname(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.