On CoreOS, /etc/hosts does not always exist.

This commit is contained in:
Stig Telfer 2016-02-23 12:04:58 +00:00
parent a46d4efba6
commit ff03c82151

View file

@ -5,6 +5,7 @@
regexp: "^{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item].ansible_default_ipv4.address)) }} {{ item }}$"
line: "{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item].ansible_default_ipv4.address)) }} {{ item }}"
state: present
create: yes
backup: yes
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']