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

11 lines
349 B
YAML
Raw Normal View History

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 }}$'
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 }}"