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 %} {% if hostvars[host].wireguard_persistent_keepalive is defined %}
PersistentKeepalive = {{hostvars[host].wireguard_persistent_keepalive}} PersistentKeepalive = {{hostvars[host].wireguard_persistent_keepalive}}
{% endif %} {% 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 != "" %} {% if hostvars[host].wireguard_endpoint is defined and hostvars[host].wireguard_endpoint != "" %}
Endpoint = {{hostvars[host].wireguard_endpoint}}:{{hostvars[host].wireguard_port}} Endpoint = {{hostvars[host].wireguard_endpoint}}:{{hostvars[host].wireguard_port}}
{% else %} {% else %}
@ -70,7 +77,7 @@ SaveConfig = true
{% endfor %} {% endfor %}
{% if wireguard_unmanaged_peers is defined %} {% 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() %} {% for peer in wireguard_unmanaged_peers.keys() %}
[Peer] [Peer]
# {{ peer }} # {{ peer }}

Loading…
Cancel
Save