diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2023-09-03 20:15:20 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2023-09-03 20:15:20 +0200 |
commit | 7ee547e760db3e776ab7ecd676ed4b8afca0f04b (patch) | |
tree | 956d4d855148c5c5011fc5704b1e924c2d04c294 /ansible/roles | |
parent | 2db366457d598ab7fa0d86b57b40b12bf1779964 (diff) | |
download | infra-7ee547e760db3e776ab7ecd676ed4b8afca0f04b.tar.gz infra-7ee547e760db3e776ab7ecd676ed4b8afca0f04b.tar.bz2 infra-7ee547e760db3e776ab7ecd676ed4b8afca0f04b.tar.xz infra-7ee547e760db3e776ab7ecd676ed4b8afca0f04b.zip |
lhn
Diffstat (limited to 'ansible/roles')
-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: |