From 5189b87321c9b209ac03f6798f816a187e330f4f Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 23 Nov 2020 21:42:14 +0100 Subject: [PATCH] use hostanem module instead of template --- tasks/config.yml | 11 +++-------- templates/etc/hostname.j2 | 3 --- 2 files changed, 3 insertions(+), 11 deletions(-) delete mode 100644 templates/etc/hostname.j2 diff --git a/tasks/config.yml b/tasks/config.yml index cad1b36..44233a3 100644 --- a/tasks/config.yml +++ b/tasks/config.yml @@ -1,13 +1,9 @@ --- - block: - name: Set hostname - template: - src: etc/hostname.j2 - dest: /etc/hostname - owner: root - group: root - mode: 0644 - register: hostname_result + hostname: + name: "{{ network_hostname }}" + when: network_hostname notify: __host_reboot - name: Set hosts file @@ -17,7 +13,6 @@ owner: root group: root mode: 0644 - register: hosts_result notify: __host_reboot - name: Add network interface configuration diff --git a/templates/etc/hostname.j2 b/templates/etc/hostname.j2 deleted file mode 100644 index 1f6315b..0000000 --- a/templates/etc/hostname.j2 +++ /dev/null @@ -1,3 +0,0 @@ -{% if network_hostname is defined %} -{{ network_hostname }} -{% endif %}