summaryrefslogtreecommitdiff
path: root/roles/network/wireguard/p2p/templates/systemd.netdev.j2
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2021-01-23 22:17:02 +0100
committerChristian Pointner <equinox@spreadspace.org>2021-01-23 22:17:02 +0100
commitaefa7a4f57f91ed62ca166ecf5fdfc2eacc04f6a (patch)
treef7bb813720bc5198cbd2c172ae6136f2927eab3e /roles/network/wireguard/p2p/templates/systemd.netdev.j2
parentadd etherwake and wakeonlan to ch-equinox-(ws|t450s) (diff)
move wireguard to network sub-dir
Diffstat (limited to 'roles/network/wireguard/p2p/templates/systemd.netdev.j2')
-rw-r--r--roles/network/wireguard/p2p/templates/systemd.netdev.j226
1 files changed, 26 insertions, 0 deletions
diff --git a/roles/network/wireguard/p2p/templates/systemd.netdev.j2 b/roles/network/wireguard/p2p/templates/systemd.netdev.j2
new file mode 100644
index 00000000..04abfa1d
--- /dev/null
+++ b/roles/network/wireguard/p2p/templates/systemd.netdev.j2
@@ -0,0 +1,26 @@
+[NetDev]
+Name={{ wireguard_p2p_interface.name }}
+Kind=wireguard
+{% if 'description' in wireguard_p2p_interface %}
+Description={{ wireguard_p2p_interface.description }}
+{% endif %}
+
+
+[WireGuard]
+PrivateKey={{ wireguard_p2p_interface.priv_key }}
+{% if 'listen_port' in wireguard_p2p_interface %}
+ListenPort={{ wireguard_p2p_interface.listen_port }}
+{% endif %}
+
+
+[WireGuardPeer]
+PublicKey={{ wireguard_p2p_peer.pub_key }}
+{% for ip in wireguard_p2p_peer.allowed_ips %}
+AllowedIPs={{ ip }}
+{% endfor %}
+{% if 'endpoint' in wireguard_p2p_peer %}
+Endpoint={{ wireguard_p2p_peer.endpoint.host }}:{{ wireguard_p2p_peer.endpoint.port | default(51820) }}
+{% endif %}
+{% if 'keepalive_interval' in wireguard_p2p_peer %}
+PersistentKeepalive={{ wireguard_p2p_peer.keepalive_interval }}
+{% endif %}