Skip to content
Snippets Groups Projects
Commit 68ad4ff4 authored by Matthew Mosesohn's avatar Matthew Mosesohn
Browse files

Add dns_domain for each host to /etc/hosts

Fixes #754
parent 114ab5e4
No related branches found
No related tags found
No related merge requests found
......@@ -3,8 +3,7 @@
blockinfile:
dest: /etc/hosts
block: |-
{% for item in groups['all'] -%}
{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item].ansible_default_ipv4.address)) }}{% if (item != hostvars[item]['ansible_hostname']) %} {{ hostvars[item]['ansible_hostname'] }}{% endif %} {{ item }}
{% for item in groups['all'] -%}{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item].ansible_default_ipv4.address)) }}{% if (item != hostvars[item]['ansible_hostname']) %} {{ hostvars[item]['ansible_hostname'] }} {{ hostvars[item]['ansible_hostname'] }}.{{ dns_domain }}{% endif %} {{ item }} {{ item }}.{{ dns_domain }}
{% endfor %}
state: present
create: yes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment