ansible-role-generate-tls-c.../tasks/populate-etc-hosts.yaml

11 lines
278 B
YAML

---
- name: Add IP address of all hosts to all hosts
become: yes
lineinfile:
dest: /etc/hosts
regexp: '.*{{ item }}$'
line: "{{ hostvars[item].ansible_host }} {{item}}"
state: present
when: hostvars[item].ansible_host is defined
loop: "{{ groups.all }}"