summaryrefslogtreecommitdiff
path: root/roles/network/wireguard/gateway/templates/systemd.netdev.j2
blob: 96399b52b07828e5f5cac7570ed26d9f413736bc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[NetDev]
Name={{ item.key }}
Kind=wireguard
{% if 'description' in item.value %}
Description={{ item.value.description }}
{% endif %}


[WireGuard]
PrivateKey={{ item.value.priv_key }}
ListenPort={{ item.value.listen_port | default(51820) }}

{% for peer in item.value.peers %}

[WireGuardPeer]
PublicKey={{ peer.pub_key }}
{%   for ip in peer.allowed_ips %}
AllowedIPs={{ ip }}
{%   endfor %}
{%   if 'endpoint' in peer %}
Endpoint={{ peer.endpoint.host }}:{{ peer.endpoint.port | default(51820) }}
{%   endif %}
{%   if 'keepalive_interval' in peer %}
PersistentKeepalive={{ peer.keepalive_interval }}
{%   endif %}
{% endfor %}