3
0
Fork 0
This repository has been archived on 2020-08-04. You can view files and clone it, but cannot push or open issues or pull requests.
ansible-role-wireguard/templates/wg-fullmesh.conf.j2

20 lines
634 B
Plaintext
Raw Normal View History

2018-07-23 21:50:53 +00:00
#jinja2: lstrip_blocks:"True",trim_blocks:"True"
2018-07-18 21:57:27 +00:00
[Interface]
2018-07-23 21:50:53 +00:00
Address = {{hostvars[inventory_hostname].wireguard_ip}}
2018-07-18 21:57:27 +00:00
PrivateKey = {{private_key}}
ListenPort = {{wireguard_port}}
{% for host in groups["vpn"] %}
2018-07-23 21:50:53 +00:00
{% if host != inventory_hostname %}
2018-07-18 21:57:27 +00:00
[Peer]
2018-07-23 21:50:53 +00:00
PublicKey = {{hostvars[host].public_key}}
AllowedIPs = {{hostvars[host].wireguard_ip}}/32
{% if hostvars[host].wireguard_endpoint is not defined %}
2018-07-18 21:57:27 +00:00
Endpoint = {{host}}:{{wireguard_port}}
2018-07-23 21:50:53 +00:00
{% elif hostvars[host].wireguard_endpoint != "" %}
Endpoint = {{hostvars[host].wireguard_endpoint}}:{{wireguard_port}}
{% endif %}
{% endif %}
2018-07-18 21:57:27 +00:00
{% endfor %}