30 lines
638 B
Text
30 lines
638 B
Text
# {{ ansible_managed }}
|
|
|
|
[Interface]
|
|
# Assign the static IP
|
|
Address = {{ address }}
|
|
|
|
{% if domain %}
|
|
# Set the DNS
|
|
DNS = {{ gateway }}, {{ domain }}
|
|
|
|
# Set the DNS for the connection
|
|
PostUp = {{ dns_command }}
|
|
{% endif %}
|
|
|
|
# Load the private key
|
|
PostUp = wg set %i private-key /etc/wireguard/private.key
|
|
|
|
# FIXME: Ping the VPN server to initiate the connection
|
|
# PostUp = ping -c3 {{ gateway }}
|
|
{% for peer in peers %}
|
|
|
|
# {{ peer.note }}
|
|
[Peer]
|
|
PublicKey = {{ peer.public_key }}
|
|
AllowedIPs = {{ peer.allowed_ips }}
|
|
Endpoint = {{ peer.endpoint }}
|
|
{% if peer.keepalive %}
|
|
PersistentKeepAlive = {{ peer.keepalive }}
|
|
{% endif %}
|
|
{% endfor %}
|