From a857eb82ec9c4a79ad5e41462e2ab82c2660982e Mon Sep 17 00:00:00 2001 From: Kumar Date: Tue, 23 Nov 2021 09:59:08 -0500 Subject: initial commit --- roles/wireguard/templates/wg0.conf.j2 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 roles/wireguard/templates/wg0.conf.j2 (limited to 'roles/wireguard/templates') diff --git a/roles/wireguard/templates/wg0.conf.j2 b/roles/wireguard/templates/wg0.conf.j2 new file mode 100644 index 0000000..6e7bcc1 --- /dev/null +++ b/roles/wireguard/templates/wg0.conf.j2 @@ -0,0 +1,17 @@ +# {{ ansible_managed }} + +[Interface] +Address = {{ wireguard_server_ip }} +ListenPort = {{ wireguard_server_listen_port }} +PrivateKey = {{ wireguard_server_priv_key }} +PostUp = iptables -A FORWARD -i wg0 -o wg0 -j ACCEPT +PostUp = iptables -w -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -w -t nat -A POSTROUTING -o eth0 -j MASQUERADE +PostDown = iptables -w -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -w -t nat -D POSTROUTING -o eth0 -j MASQUERADE + + +{% for peer in wireguard_peers %} +[Peer] +PublicKey = {{ peer.peer_key }} +AllowedIPs = {{ peer.peer_ip}} + +{% endfor %} -- cgit v1.2.3