The `hostname.yml` playbook does what it says on the tin: it sets the hostname of the managed node. The `preferred_hostname` variable can be used to specify the value to use for the hostname. If it is not set, the name specified in the inventory is used.
6 lines
127 B
YAML
6 lines
127 B
YAML
- hosts: all
|
|
tasks:
|
|
- name: ensure hostname is set
|
|
hostname:
|
|
name={{ preferred_hostname|d(inventory_hostname) }}
|