aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/network/templates/wireguard.conf.j2
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles/network/templates/wireguard.conf.j2')
-rw-r--r--ansible/roles/network/templates/wireguard.conf.j212
1 files changed, 12 insertions, 0 deletions
diff --git a/ansible/roles/network/templates/wireguard.conf.j2 b/ansible/roles/network/templates/wireguard.conf.j2
new file mode 100644
index 0000000..907d546
--- /dev/null
+++ b/ansible/roles/network/templates/wireguard.conf.j2
@@ -0,0 +1,12 @@
+[Interface]
+Address = {{ vpn_ip }}
+PrivateKey = {{ wireguard_privkey.stdout }}
+ListenPort = 51820
+
+{% for selected_host in groups['cluster_nodes']|difference([inventory_hostname]) %}
+[Peer]
+PublicKey = {{ hostvars[selected_host].wireguard_pubkey.stdout }}
+Endpoint = {{ hostvars[selected_host].public_ip }}:{{ hostvars[selected_host].public_vpn_port }}
+AllowedIPs = {{ hostvars[selected_host].vpn_ip }}/32
+PersistentKeepalive = 25
+{% endfor %}