From e327db1f4fd9ad1e30e9ccf6f832ed933856b674 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Tue, 2 Jan 2018 23:37:00 -0600 Subject: [PATCH] hostname: Playbook to set system hostname 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. --- hostname.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 hostname.yml diff --git a/hostname.yml b/hostname.yml new file mode 100644 index 0000000..cf3667c --- /dev/null +++ b/hostname.yml @@ -0,0 +1,5 @@ +- hosts: all + tasks: + - name: ensure hostname is set + hostname: + name={{ preferred_hostname|d(inventory_hostname) }}