From b6d02e11cc8ac63ce717f1a9be092f1f541745b6 Mon Sep 17 00:00:00 2001 From: Tharre Date: Tue, 19 Feb 2019 05:45:25 +0100 Subject: Add WireGuard role --- roles/wireguard/templates/wg.conf.j2 | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 roles/wireguard/templates/wg.conf.j2 (limited to 'roles/wireguard/templates/wg.conf.j2') diff --git a/roles/wireguard/templates/wg.conf.j2 b/roles/wireguard/templates/wg.conf.j2 new file mode 100644 index 0000000..bac19a9 --- /dev/null +++ b/roles/wireguard/templates/wg.conf.j2 @@ -0,0 +1,37 @@ +[Interface] +{% for addr in item.address %} +Address = {{ addr }} +{% endfor %} +{% if item.dns is defined %} +DNS = {{ item.dns }} +{% endif %} +{% if item.preUp is defined %} +PreUp = {{ item.preUp }} +{% endif %} +{% if item.preDown is defined %} +PreDown = {{ item.preDown }} +{% endif %} +{% if item.postUp is defined %} +PostUp = {{ item.postUp }} +{% endif %} +{% if item.postDown is defined %} +PostDown = {{ item.postDown }} +{% endif %} +ListenPort = {{ item.port }} +PrivateKey = {{ item.privateKey }} +{% if item.fwmark is defined %} +Fwmark = {{ item.fwmark }} +{% endif %} + +{% for peer in item.peers %} +[Peer] +PublicKey = {{ peer.publicKey }} +{% if peer.presharedKey is defined %} +PresharedKey = {{ peer.presharedKey }} +{% endif %} +AllowedIPs = {{ peer.allowedIPs }} +{% if peer.persistentKeepalive is defined %} +PersistentKeepalive = {{ peer.persistentKeepalive }} +{% endif %} + +{% endfor %} -- cgit v1.2.3-70-g09d2