Browse Source

Merge pull request #76 from rackn/dns-ip

Use IP is specified, otherwise use the ansible discovered address.
pull/77/merge
Antoine Legrand 8 years ago
parent
commit
9156d1ecfd
1 changed files with 2 additions and 2 deletions
  1. 4
      roles/dnsmasq/tasks/main.yml

4
roles/dnsmasq/tasks/main.yml

@ -2,8 +2,8 @@
- name: populate inventory into hosts file
lineinfile:
dest: /etc/hosts
regexp: "^{{ hostvars[item].ansible_default_ipv4.address }} {{ item }}$"
line: "{{ hostvars[item].ansible_default_ipv4.address }} {{ item }}"
regexp: "^{{ hostvars[item]['ip'] | default(hostvars[item].ansible_default_ipv4.address) }} {{ item }}$"
line: "{{ hostvars[item]['ip'] | default(hostvars[item].ansible_default_ipv4.address) }} {{ item }}"
state: present
backup: yes
when: hostvars[item].ansible_default_ipv4.address is defined

Loading…
Cancel
Save