From 6c48dc25d43abd25a0bace55aec2d358655e9e27 Mon Sep 17 00:00:00 2001 From: Tobias Manske Date: Wed, 13 Sep 2023 05:10:01 +0200 Subject: [PATCH] Add Hosts to each others /etc/hosts file --- coreos-config/plays/vpn.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/coreos-config/plays/vpn.yaml b/coreos-config/plays/vpn.yaml index d08a411..5a43a3b 100644 --- a/coreos-config/plays/vpn.yaml +++ b/coreos-config/plays/vpn.yaml @@ -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