Files
computer-playbook/roles/svc-net-wireguard/templates/wg.conf.j2
evangelostsak 13f627ba23 feat(wireguard): every member of a full mesh listens and dials its peers
The hub listens and a spoke dials its hub, as before. In a full mesh every
member listens on the mesh port and keeps every peer alive.
2026-10-16 03:40:15 +02:00

20 lines
581 B
Django/Jinja

[Interface]
Address = {{ mesh.address }}/{{ mesh.subnet.split('/')[1] }}
PrivateKey = {{ WIREGUARD_PRIVATE_KEY }}
MTU = {{ wireguard_mtu | int }}
{% if mesh | mesh_listens %}
ListenPort = {{ mesh.listen_port | int }}
{% endif %}
{% set dialled = mesh | mesh_dialled_peers | map(attribute='host') | list %}
{% for peer in mesh.peers %}
[Peer]
PublicKey = {{ peer.public_key }}
AllowedIPs = {{ peer.allowed_ips }}
{% if peer.host in dialled %}
Endpoint = {{ peer.endpoint | default(peer.host, true) }}:{{ mesh.listen_port | int }}
PersistentKeepalive = 25
{% endif %}
{% endfor %}