ansible-role-wireguard_client/templates/wireguard_client.conf

14 lines
700 B
Text
Raw Normal View History

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 }}
2023-08-09 13:49:56 +02:00
{% if item.EndPointIP is defined and item.EndPointIP != '' %}EndPoint = {{ item.EndPointIP }}:{{ item.listenport | default(listenport) }}{% endif %}{% endif %}{% endfor %}