summaryrefslogtreecommitdiff
path: root/roles/install_wireguard_mesh/templates/wg.conf.j2
diff options
context:
space:
mode:
Diffstat (limited to 'roles/install_wireguard_mesh/templates/wg.conf.j2')
-rw-r--r--roles/install_wireguard_mesh/templates/wg.conf.j212
1 files changed, 7 insertions, 5 deletions
diff --git a/roles/install_wireguard_mesh/templates/wg.conf.j2 b/roles/install_wireguard_mesh/templates/wg.conf.j2
index e3af3f2..410d591 100644
--- a/roles/install_wireguard_mesh/templates/wg.conf.j2
+++ b/roles/install_wireguard_mesh/templates/wg.conf.j2
@@ -1,15 +1,17 @@
[Interface]
ListenPort = {{ item.wireguard_mesh_port }}
-PrivateKey = {{ item.wireguard_mesh_key }}
+PrivateKey = {{ item.wireguard_mesh_priv_key }}
Address = {{ item.wireguard_mesh_address }}/48
MTU = 1400
PostUp = /etc/wireguard/up{{ item.name }}.sh
PreDown = /etc/wireguard/down{{ item.name }}.sh
-{% for peer in item.wireguard_mesh_peers %}
+{% for host in groups['fastd'] %}
+{% for site in hostvars[host]['sites'] if site.name == item.name and site.wireguard_mesh_number != item.wireguard_mesh_number %}
[Peer]
-PublicKey = {{ peer.key }}
-AllowedIPs = {{ peer.address }}/128
-Endpoint = [{{ peer.endpoint }}]:{{ item.wireguard_mesh_port }}
+PublicKey = {{ site.wireguard_mesh_pub_key }}
+AllowedIPs = {{ site.wireguard_mesh_address }}/128
+Endpoint = [{{ site.wireguard_mesh_endpoint }}]:{{ item.wireguard_mesh_port }}
PersistentKeepalive = 30
{% endfor %}
+{% endfor %}