summaryrefslogtreecommitdiff
path: root/playbooks/roles/wireguard-mesh/templates/mmtmesh.conf.j2
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/roles/wireguard-mesh/templates/mmtmesh.conf.j2')
-rw-r--r--playbooks/roles/wireguard-mesh/templates/mmtmesh.conf.j211
1 files changed, 9 insertions, 2 deletions
diff --git a/playbooks/roles/wireguard-mesh/templates/mmtmesh.conf.j2 b/playbooks/roles/wireguard-mesh/templates/mmtmesh.conf.j2
index aa15d23..634b20a 100644
--- a/playbooks/roles/wireguard-mesh/templates/mmtmesh.conf.j2
+++ b/playbooks/roles/wireguard-mesh/templates/mmtmesh.conf.j2
@@ -1,8 +1,11 @@
[Interface]
Address={{ wireguard_node_ips[inventory_hostname] }}/32
-SaveConfig=true
ListenPort={{ wireguard_listen_port }}
PrivateKey={{ wireguard_private_key.stdout }}
+SaveConfig=true
+{% if wireguard_node_ips[inventory_hostname] != '10.212.0.1' %}
+PostUp=ip route add 10.137.0.0/16 via 10.212.0.1 dev mmtmesh
+{% endif %}
{% for peer in groups['wireguard-mesh'] %}
{% if peer != inventory_hostname %}
@@ -10,8 +13,12 @@ PrivateKey={{ wireguard_private_key.stdout }}
[Peer]
PublicKey={{ hostvars[peer].wireguard_public_key.stdout }}
PresharedKey={{ wireguard_preshared_keys[peer] if inventory_hostname < peer else hostvars[peer].wireguard_preshared_keys[inventory_hostname] }}
+{% if wireguard_node_ips[peer] == '10.212.0.1' %}
+AllowedIPs={{ wireguard_node_ips[peer] }}/32, 10.137.0.0/16
+{% else %}
AllowedIPs={{ wireguard_node_ips[peer] }}/32
-Endpoint={{ peer | replace('.int.', '.pub.') }}:{{ wireguard_listen_port }}
+{% endif %}
+Endpoint={{ peer | replace('.int.', '.') }}:{{ wireguard_listen_port }}
{% endif %}
{% endfor %}