aboutsummaryrefslogtreecommitdiffstats
path: root/roles/wireguard/templates/dcontroller.conf.j2
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2021-03-17 20:53:31 +0100
committerbinary <me@rgoncalves.se>2021-03-17 20:53:31 +0100
commitedfeb6401af135348ddd38518a27be3e8ec51f6a (patch)
treea179029da1de48d7a8edf7e4a4c7902324f9e751 /roles/wireguard/templates/dcontroller.conf.j2
parent3e8b7f77311d32fd11e05d6f11d454aa40ed0aec (diff)
downloadinfrastructure-edfeb6401af135348ddd38518a27be3e8ec51f6a.tar.gz
Make wireguard unreachables/failures free
Diffstat (limited to 'roles/wireguard/templates/dcontroller.conf.j2')
-rw-r--r--roles/wireguard/templates/dcontroller.conf.j25
1 files changed, 4 insertions, 1 deletions
diff --git a/roles/wireguard/templates/dcontroller.conf.j2 b/roles/wireguard/templates/dcontroller.conf.j2
index 7213925..a8e6292 100644
--- a/roles/wireguard/templates/dcontroller.conf.j2
+++ b/roles/wireguard/templates/dcontroller.conf.j2
@@ -8,12 +8,15 @@
ListenPort = 53
PrivateKey = {{ dcontroller_keys[0] }}
-{% for host in groups["all"] if hostvars[host].ansible_host != global.dcontroller %}
+{% for host in groups["all"] %}
{% set host = hostvars[host] %}
+{##}
+{% if host.ansible_host != global.dcontroller and host.ip is defined %}
{% set host_keys = lookup("file", wg_dir + "/" + host.ansible_host + ".keys").splitlines() %}
# {{ host.ansible_host }}
[Peer]
PublicKey = {{ host_keys[1] }}
AllowedIPs = {{ host.ip.in }}/32, fd00:10:10::{{ host.ip.in.split('.')[3] }}/128
+{% endif %}
{% endfor %}
remember that computers suck.