From 42e539af3ce3c24f1ee254beb3000242280aa8f8 Mon Sep 17 00:00:00 2001 From: Thomas Schneider <tschneider@asta.rwth-aachen.de> Date: Wed, 2 Dec 2020 16:33:07 +0100 Subject: [PATCH] basic-system/network: Use ansible_hostname instead of inventory_hostname The latter one is not always a non-qualified name, in AStA it is a FQDN. --- basic-system/tasks/network.yml | 2 +- basic-system/templates/hosts.j2 | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/basic-system/tasks/network.yml b/basic-system/tasks/network.yml index 57f23f7..5d8d64f 100644 --- a/basic-system/tasks/network.yml +++ b/basic-system/tasks/network.yml @@ -21,7 +21,7 @@ - name: ensure the hostname is not a fqdn hostname: - name: "{{ inventory_hostname }}" + name: "{{ ansible_hostname }}" when: not dns_hostname_fqdn notify: - gather network facts once again diff --git a/basic-system/templates/hosts.j2 b/basic-system/templates/hosts.j2 index cdfed95..e26791f 100644 --- a/basic-system/templates/hosts.j2 +++ b/basic-system/templates/hosts.j2 @@ -7,11 +7,11 @@ ff02::2 ip6-allrouters ff02::3 ip6-allhosts {% for host in hosts_alternates %} -{{ host }} {{ ansible_host }} {{ inventory_hostname }} +{{ host }} {{ ansible_host }} {{ ansible_hostname }} {% else %} -{{ ansible_default_ipv4.address }} {{ ansible_host }} {{ inventory_hostname }} +{{ ansible_default_ipv4.address }} {{ ansible_host }} {{ ansible_hostname }} {% if 'address' in ansible_default_ipv6 %} -{{ ansible_default_ipv6.address }} {{ ansible_host }} {{ inventory_hostname }} +{{ ansible_default_ipv6.address }} {{ ansible_host }} {{ ansible_hostname }} {% endif %} {% endfor %} -- GitLab