2020-05-21 13:27:09 +00:00
|
|
|
[Interface]
|
|
|
|
Address = {{ vpn_ip }}
|
2020-05-23 15:16:25 +00:00
|
|
|
PostUp = wg set %i private-key <(cat /etc/wireguard/privkey)
|
2020-05-21 13:27:09 +00:00
|
|
|
ListenPort = 51820
|
|
|
|
|
|
|
|
{% for selected_host in groups['cluster_nodes']|difference([inventory_hostname]) %}
|
|
|
|
[Peer]
|
|
|
|
PublicKey = {{ hostvars[selected_host].wireguard_pubkey.stdout }}
|
|
|
|
Endpoint = {{ hostvars[selected_host].public_ip }}:{{ hostvars[selected_host].public_vpn_port }}
|
|
|
|
AllowedIPs = {{ hostvars[selected_host].vpn_ip }}/32
|
|
|
|
PersistentKeepalive = 25
|
|
|
|
{% endfor %}
|
2020-05-21 21:41:39 +00:00
|
|
|
|
|
|
|
{% for host in other_vpn_nodes %}
|
|
|
|
[Peer]
|
|
|
|
PublicKey = {{ host.pubkey }}
|
|
|
|
Endpoint = {{ host.public_ip }}:{{ host.public_vpn_port }}
|
|
|
|
AllowedIPs = {{ host.vpn_ip }}/32
|
|
|
|
PersistentKeepalive = 25
|
|
|
|
{% endfor %}
|