diff options
Diffstat (limited to 'ansible/roles/wireguard/tasks/main.yml')
-rw-r--r-- | ansible/roles/wireguard/tasks/main.yml | 14 |
1 files changed, 7 insertions, 7 deletions
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: |