set up role for wireguard connections

This commit is contained in:
Jef Roosens 2026-04-02 22:03:26 +02:00
parent 39a531cf87
commit 6c77886916
Signed by: Jef Roosens
GPG key ID: 21FD3D77D56BAF49
9 changed files with 137 additions and 0 deletions

View file

@ -0,0 +1,16 @@
[Interface]
Address = {{ wireguard_address }}
PrivateKey = {{ wireguard_private_key }}
ListenPort = {{ wireguard_port }}
{% for host in wireguard_peers %}
{% if host != inventory_hostname %}
[Peer]
# {{ host }}
PublicKey = {{ hostvars[host]['wireguard_public_key'] }}
AllowedIPs = {{ hostvars[host]['wireguard_address'].split('/')[0] }}/32
Endpoint = {{ hostvars[host]['ansible_host'] | default(host) }}:{{ hostvars[host]['wireguard_port'] | default(wireguard_port) }}
PersistentKeepalive = {{ wireguard_keepalive }}
{% endif %}
{% endfor %}