From aea6b114e050545ccc8b953c579d53c9158e238b Mon Sep 17 00:00:00 2001 From: binary Date: Sun, 15 Nov 2020 17:26:32 +0100 Subject: I'm so lazy so ignore this cimment this time pls --- roles/wireguard/templates/dcontroller.conf.j2 | 2 +- roles/wireguard/templates/host.conf.j2 | 2 +- roles/wireguard/templates/hostname.j2 | 9 +++++++++ roles/wireguard/templates/hostname.tun0.j2 | 9 --------- 4 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 roles/wireguard/templates/hostname.j2 delete mode 100644 roles/wireguard/templates/hostname.tun0.j2 (limited to 'roles/wireguard/templates') diff --git a/roles/wireguard/templates/dcontroller.conf.j2 b/roles/wireguard/templates/dcontroller.conf.j2 index c1fd887..5771ef6 100644 --- a/roles/wireguard/templates/dcontroller.conf.j2 +++ b/roles/wireguard/templates/dcontroller.conf.j2 @@ -1,5 +1,5 @@ -# wireguard client configuration ~~ /etc/wireguard/*.conf +# wireguard dcontroller configuration ~~ /etc/wireguard/*.conf # managed by Ansible {% set dcontroller_keys = lookup("file", wg_dcontroller_keys).splitlines() %} diff --git a/roles/wireguard/templates/host.conf.j2 b/roles/wireguard/templates/host.conf.j2 index c25d937..2a5acc5 100644 --- a/roles/wireguard/templates/host.conf.j2 +++ b/roles/wireguard/templates/host.conf.j2 @@ -5,7 +5,7 @@ {% set dcontroller_keys = lookup("file", wg_dcontroller_keys).splitlines() %} [Interface] -Address = {{ ip.in }} +Address = {{ ip.in }}, fd00:10:10::{{ ip.in.split(".")[3] }} PrivateKey = {{ host_keys[0] }} [Peer] diff --git a/roles/wireguard/templates/hostname.j2 b/roles/wireguard/templates/hostname.j2 new file mode 100644 index 0000000..3903ccb --- /dev/null +++ b/roles/wireguard/templates/hostname.j2 @@ -0,0 +1,9 @@ +inet 10.10.0.1 255.255.255.0 +inet6 fd00:10:10::1 +!/usr/local/bin/wireguard-go -f tun0 & +!/bin/sleep 2 +!/usr/local/bin/wg setconf tun0 /etc/wireguard/{{ _i.dcontroller }}.conf +!/bin/sleep 2 +!/sbin/route add -inet 10.10.0.0/24 10.10.0.1 +!/bin/sleep 2 +!/sbin/route add -inet6 fd00:10:10::/64 fd00:10:10::1 diff --git a/roles/wireguard/templates/hostname.tun0.j2 b/roles/wireguard/templates/hostname.tun0.j2 deleted file mode 100644 index 3903ccb..0000000 --- a/roles/wireguard/templates/hostname.tun0.j2 +++ /dev/null @@ -1,9 +0,0 @@ -inet 10.10.0.1 255.255.255.0 -inet6 fd00:10:10::1 -!/usr/local/bin/wireguard-go -f tun0 & -!/bin/sleep 2 -!/usr/local/bin/wg setconf tun0 /etc/wireguard/{{ _i.dcontroller }}.conf -!/bin/sleep 2 -!/sbin/route add -inet 10.10.0.0/24 10.10.0.1 -!/bin/sleep 2 -!/sbin/route add -inet6 fd00:10:10::/64 fd00:10:10::1 -- cgit v1.2.3