infrastructure/ansible/roles/network/templates/wireguard.conf.j2

13 lines
444 B
Django/Jinja

[Interface]
Address = {{ vpn_ip }}
PrivateKey = {{ wireguard_privkey.stdout }}
ListenPort = 51820
{% for selected_host in groups['cluster_nodes']|difference([inventory_hostname]) %}
[Peer]
PublicKey = {{ hostvars[selected_host].wireguard_pubkey.stdout }}
Endpoint = {{ hostvars[selected_host].public_ip }}:{{ hostvars[selected_host].public_vpn_port }}
AllowedIPs = {{ hostvars[selected_host].vpn_ip }}/32
PersistentKeepalive = 25
{% endfor %}