2021-01-24 12:50:08 +01:00
|
|
|
---
|
|
|
|
- name: Add IP address of all hosts to all hosts
|
|
|
|
become: yes
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/hosts
|
|
|
|
regexp: '.*{{ item }}$'
|
2021-01-24 18:30:36 +01:00
|
|
|
line: "{{ hostvars[item].ansible_host }} {{item}}{% if gen_tls_tld is defined %} {{ item }}.{{ gen_tls_tld }}{% endif %}"
|
2021-01-24 12:50:08 +01:00
|
|
|
state: present
|
|
|
|
when: hostvars[item].ansible_host is defined
|
|
|
|
loop: "{{ groups.all }}"
|