Files
wg-backup/templates/wg0.conf.j2
T

29 lines
884 B
Django/Jinja

{{ ansible_managed | comment }}
# Relay tunnel. This box forwards nothing; see the sysctl and nftables
# tasks in wg-relay.yml.
[Interface]
Address = {{ wg_address }}
ListenPort = {{ wg_listen_port }}
MTU = {{ wg_mtu }}
PrivateKey = {{ wg_relay_effective_private_key }}
{% if wg_active_peers | length == 0 %}
# No peer has a real public key yet. The interface comes up with no peers so
# this side can generate and print its key; add the peer's key and re-run.
{% endif %}
{% for peer in wg_active_peers %}
# {{ peer.name }}
[Peer]
PublicKey = {{ peer.public_key }}
AllowedIPs = {{ peer.allowed_ips }}
{% if peer.endpoint is defined and peer.endpoint %}
Endpoint = {{ peer.endpoint }}
{% endif %}
{% if peer.preshared_key is defined and peer.preshared_key %}
PresharedKey = {{ peer.preshared_key }}
{% endif %}
PersistentKeepalive = {{ peer.keepalive | default(25) }}
{% endfor %}