aboutsummaryrefslogtreecommitdiffstats
path: root/roles/wireguard/templates
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2020-11-20 19:20:55 +0100
committerbinary <me@rgoncalves.se>2020-11-20 19:20:55 +0100
commitc110f9a103c2f676917e3fe5e33f4eaedfed070c (patch)
tree072f1b019ae7d0c39a0cbd9d88257688203edddc /roles/wireguard/templates
parentb739e2af7060cd10f65d97cd0bfc0e9adb7a5490 (diff)
downloadinfrastructure-c110f9a103c2f676917e3fe5e33f4eaedfed070c.tar.gz
Refactor wireguard role with new host declaration.
Diffstat (limited to 'roles/wireguard/templates')
-rw-r--r--roles/wireguard/templates/dcontroller.conf.j22
-rw-r--r--roles/wireguard/templates/host.conf.j22
-rw-r--r--roles/wireguard/templates/hostname.j22
3 files changed, 3 insertions, 3 deletions
diff --git a/roles/wireguard/templates/dcontroller.conf.j2 b/roles/wireguard/templates/dcontroller.conf.j2
index 5771ef6..7213925 100644
--- a/roles/wireguard/templates/dcontroller.conf.j2
+++ b/roles/wireguard/templates/dcontroller.conf.j2
@@ -8,7 +8,7 @@
ListenPort = 53
PrivateKey = {{ dcontroller_keys[0] }}
-{% for host in groups["all"] if hostvars[host].ansible_host != _i.dcontroller %}
+{% for host in groups["all"] if hostvars[host].ansible_host != global.dcontroller %}
{% set host = hostvars[host] %}
{% set host_keys = lookup("file", wg_dir + "/" + host.ansible_host + ".keys").splitlines() %}
# {{ host.ansible_host }}
diff --git a/roles/wireguard/templates/host.conf.j2 b/roles/wireguard/templates/host.conf.j2
index 2a5acc5..4c693eb 100644
--- a/roles/wireguard/templates/host.conf.j2
+++ b/roles/wireguard/templates/host.conf.j2
@@ -10,6 +10,6 @@ PrivateKey = {{ host_keys[0] }}
[Peer]
PublicKey = {{ dcontroller_keys[1] }}
-Endpoint = {{ hostvars[_i.dcontroller].ip.out }}:53
+Endpoint = {{ hostvars[global.dcontroller].ip.out }}:53
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 25
diff --git a/roles/wireguard/templates/hostname.j2 b/roles/wireguard/templates/hostname.j2
index 3903ccb..8938320 100644
--- a/roles/wireguard/templates/hostname.j2
+++ b/roles/wireguard/templates/hostname.j2
@@ -2,7 +2,7 @@ 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
+!/usr/local/bin/wg setconf tun0 /etc/wireguard/{{ global.dcontroller }}.conf
!/bin/sleep 2
!/sbin/route add -inet 10.10.0.0/24 10.10.0.1
!/bin/sleep 2
remember that computers suck.