mmt-infra/playbooks/roles/wireguard-mesh/templates/mmtmesh.conf.j2

22 lines
736 B
Plaintext
Raw Normal View History

2024-05-01 04:33:35 -04:00
[Interface]
Address={{ wireguard_node_ips[inventory_hostname] }}/32
ListenPort={{ wireguard_listen_port }}
PrivateKey={{ wireguard_private_key.stdout }}
2024-05-04 16:19:48 -04:00
SaveConfig=true
2024-05-01 04:33:35 -04:00
{% for peer in groups['wireguard-mesh'] %}
{% if peer != inventory_hostname %}
[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] }}
2024-05-04 16:19:48 -04:00
{% if wireguard_node_ips[peer] == '10.212.0.1' %}
AllowedIPs={{ wireguard_node_ips[peer] }}/32, 10.137.0.0/16
{% else %}
2024-05-01 04:33:35 -04:00
AllowedIPs={{ wireguard_node_ips[peer] }}/32
2024-05-04 16:19:48 -04:00
{% endif %}
Endpoint={{ peer | replace('.int.', '.') }}:{{ wireguard_listen_port }}
2024-05-01 04:33:35 -04:00
{% endif %}
{% endfor %}