From 7ee547e760db3e776ab7ecd676ed4b8afca0f04b Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 3 Sep 2023 20:15:20 +0200 Subject: lhn --- ansible/roles/wireguard/tasks/main.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'ansible/roles') diff --git a/ansible/roles/wireguard/tasks/main.yml b/ansible/roles/wireguard/tasks/main.yml index a91aea5..193b549 100644 --- a/ansible/roles/wireguard/tasks/main.yml +++ b/ansible/roles/wireguard/tasks/main.yml @@ -3,8 +3,8 @@ become: yes when: wireguard__state == 'present' vars: - wg_net: "{{ hostvars[ansible_hostname][wireguard__name] }}" - wg_host: "{{ wg_net.hosts[ansible_hostname] }}" + wg_net: "{{ hostvars[inventory_hostname][wireguard__name] }}" + wg_host: "{{ wg_net.hosts[inventory_hostname] }}" all_peers: "{{ wg_host.peers is defined and wg_host.peers == 'all' }}" netdev_path: "/etc/systemd/network/60-{{ wg_net.if }}.netdev" network_path: "/etc/systemd/network/61-{{ wg_net.if }}.network" @@ -104,11 +104,11 @@ Name={{ wg_net.if }} [Network] - {% if wg_net.hosts[ansible_hostname].ipv4 is defined %} - Address={{ wg_net.hosts[ansible_hostname].ipv4 }}/{{ wg_net.ipv4_prefix }} + {% if wg_net.hosts[inventory_hostname].ipv4 is defined %} + Address={{ wg_net.hosts[inventory_hostname].ipv4 }}/{{ wg_net.ipv4_prefix }} {% endif %} - {% if wg_net.hosts[ansible_hostname].ipv6 is defined %} - Address={{ wg_net.hosts[ansible_hostname].ipv6 }}/{{ wg_net.ipv6_prefix }} + {% if wg_net.hosts[inventory_hostname].ipv6 is defined %} + Address={{ wg_net.hosts[inventory_hostname].ipv6 }}/{{ wg_net.ipv6_prefix }} {% endif %} {% if wg_net.shared_routes is defined %} @@ -124,7 +124,7 @@ become: yes when: wireguard__state == 'absent' vars: - wg_net: "{{ hostvars[ansible_hostname][wireguard__name] }}" + wg_net: "{{ hostvars[inventory_hostname][wireguard__name] }}" netdev_path: "/etc/systemd/network/60-{{ wg_net.if }}.netdev" network_path: "/etc/systemd/network/61-{{ wg_net.if }}.network" block: -- cgit v1.2.3