aboutsummaryrefslogtreecommitdiffstats
path: root/roles/wireguard/templates/dcontroller.conf.j2
blob: 7213925994d559df7c8550778879c1dbb1febed7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

# wireguard dcontroller configuration ~~ /etc/wireguard/*.conf
# managed by Ansible
{% set dcontroller_keys = lookup("file", wg_dcontroller_keys).splitlines() %}

[Interface]
#Address = {{ ip.in }}, fd00::1/128
ListenPort = 53
PrivateKey = {{ dcontroller_keys[0] }}

{% 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 }}
[Peer]
PublicKey = {{ host_keys[1] }}
AllowedIPs = {{ host.ip.in }}/32, fd00:10:10::{{ host.ip.in.split('.')[3] }}/128

{% endfor %}
remember that computers suck.