2022-10-11 09:19:16 +02:00
|
|
|
[Interface]
|
2023-08-09 13:49:11 +02:00
|
|
|
Address = {% for item in wireguard_peers %}{% if item['name'] == inventory_hostname %}{{ item['AllowedIPs'] }}{% endif %}{% endfor %}
|
2022-11-04 16:55:00 +01:00
|
|
|
PrivateKey = {{ private_key }}
|
2022-10-11 09:19:16 +02:00
|
|
|
ListenPort = {{ listenport }}
|
2023-08-09 13:49:11 +02:00
|
|
|
DNS = {% if vpn_dns is defined %}{{ vpn_dns }}{% else %}{{ server_address }}{% endif %}
|
2022-10-11 09:19:16 +02:00
|
|
|
|
2022-11-04 17:18:13 +01:00
|
|
|
{% for item in wireguard_peers %}{% if item['name'] != inventory_hostname and 'PublicKey' in item and 'AllowedIPs' in item %}
|
2022-11-04 16:55:00 +01:00
|
|
|
|
|
|
|
# Peer name: {{ item.name }}
|
2022-10-11 09:19:16 +02:00
|
|
|
[Peer]
|
2022-11-04 16:55:00 +01:00
|
|
|
PublicKey = {{ item.PublicKey }}
|
|
|
|
AllowedIPs = {{ item.AllowedIPs }}
|
|
|
|
{% if item.EndPointIP is defined and item.EndPointIP != '' %}
|
2022-11-04 17:54:06 +01:00
|
|
|
EndPoint = {{ item.EndPointIP }}:{{ item.listenport | default(listenport) }}
|
2022-11-04 16:55:57 +01:00
|
|
|
{% endif %}
|
2022-11-04 17:10:08 +01:00
|
|
|
{% endif %}{% endfor %}
|