diff --git a/basic-system/tasks/network.yml b/basic-system/tasks/network.yml index 57f23f7d34e133b812cb917bdad354e3ea5d7f3f..5d8d64f74fae85aa9a9daf31d7fb28c36c7f7da9 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 cdfed956a634f31717068171a8609d2de9a33887..e26791f07e8d5b23775049e51cfff054efe1caac 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 %}