~xenrox/ansible

ref: 1f2402ad2d1a95b6a79883a54cef4931faf87ae6 ansible/roles/wireguard/templates/wg0.netdev.j2 -rw-r--r-- 574 bytes
1f2402adThorben Günther build: Configure coloured output 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[NetDev]
Name=wg0
Kind=wireguard
Description=WireGuard tunnel wg0

[WireGuard]
ListenPort=51820
PrivateKey={{ lookup('file', '/home/xenrox/decrypted/wireguard/' ~ inventory_hostname ~ '.key') }}

{% for host in groups['wireguard'] if host != inventory_hostname %}
[WireGuardPeer]
PublicKey={{ lookup('file', '/home/xenrox/decrypted/wireguard/' ~ host ~ '.pub') }}
PresharedKey={{ lookup('file', '/home/xenrox/decrypted/wireguard/' ~ inventory_hostname ~ '_' ~ host ~ '.psk') }}
AllowedIPs={{ hostvars[host]['wireguard_address'] }}/32
Endpoint={{ host }}:51820

{% endfor %}