Skip to content
Commits on Source (2)
......@@ -10,7 +10,7 @@
- name: Ensure hostname is in /etc/hosts
lineinfile:
dest=/etc/hosts
regexp="^127.0.1.1.+$"
line="127.0.1.1 {{ ansible_fqdn }} {{ ansible_hostname }} {{ inventory_hostname }}"
regexp="^{{ ip | default(ansible_default_ipv4.address) }}.+$"
line="{{ ip | default(ansible_default_ipv4.address) }} {{ ansible_fqdn }} {{ ansible_hostname }} {{ inventory_hostname }}"
tags: hostname