Add Hosts to each others /etc/hosts file

This commit is contained in:
Tobias Manske 2023-09-13 05:10:01 +02:00
parent 8899e1e06b
commit 6c48dc25d4
Signed by: tobias
GPG Key ID: 9164B527694A0709
1 changed files with 8 additions and 0 deletions

View File

@ -47,6 +47,14 @@
ansible.builtin.systemd:
name: wg-quick@wg_infra
enabled: true
- name: Setup /etc/hosts
ansible.builtin.lineinfile:
path: /etc/hosts
regexp: "^{{ item }}\\s"
line: "{{ hostvars[item]['wg_addr'] | mandatory }} {{ item }}"
state: present
loop: "{{ nodes }}"
when: item != inventory_hostname
handlers:
- name: Restart wireguard