proper formatting of WireGuard config file / add wireguard_dc variable (#74)

master
Robert Wimmer 4 years ago committed by GitHub
parent f35670a0e4
commit e9e95f80e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -53,7 +53,14 @@ SaveConfig = true
{% if hostvars[host].wireguard_persistent_keepalive is defined %}
PersistentKeepalive = {{hostvars[host].wireguard_persistent_keepalive}}
{% endif %}
{% if hostvars[host].wireguard_port is defined and hostvars[host].wireguard_port is number %}
{% if (
hostvars[host].wireguard_dc is defined and
hostvars[inventory_hostname].wireguard_dc is defined and
hostvars[inventory_hostname].wireguard_dc['name'] != hostvars[host].wireguard_dc['name']
)
%}
Endpoint = {{hostvars[host].wireguard_dc['endpoint']}}:{{hostvars[host].wireguard_dc['port']}}
{% elif hostvars[host].wireguard_port is defined and hostvars[host].wireguard_port is number %}
{% if hostvars[host].wireguard_endpoint is defined and hostvars[host].wireguard_endpoint != "" %}
Endpoint = {{hostvars[host].wireguard_endpoint}}:{{hostvars[host].wireguard_port}}
{% else %}
@ -70,7 +77,7 @@ SaveConfig = true
{% endfor %}
{% if wireguard_unmanaged_peers is defined %}
# Peers not managed by ansible from wireguard_unmanaged_peers
# Peers not managed by Ansible from "wireguard_unmanaged_peers" variable
{% for peer in wireguard_unmanaged_peers.keys() %}
[Peer]
# {{ peer }}

Loading…
Cancel
Save