20 lines
634 B
Django/Jinja
20 lines
634 B
Django/Jinja
#jinja2: lstrip_blocks:"True",trim_blocks:"True"
|
|
[Interface]
|
|
Address = {{hostvars[inventory_hostname].wireguard_ip}}
|
|
PrivateKey = {{private_key}}
|
|
ListenPort = {{wireguard_port}}
|
|
|
|
{% for host in groups["vpn"] %}
|
|
{% if host != inventory_hostname %}
|
|
[Peer]
|
|
PublicKey = {{hostvars[host].public_key}}
|
|
AllowedIPs = {{hostvars[host].wireguard_ip}}/32
|
|
{% if hostvars[host].wireguard_endpoint is not defined %}
|
|
Endpoint = {{host}}:{{wireguard_port}}
|
|
{% elif hostvars[host].wireguard_endpoint != "" %}
|
|
Endpoint = {{hostvars[host].wireguard_endpoint}}:{{wireguard_port}}
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
{% endfor %}
|