Check if wireguard_endpoint exists before checking if it is empty (#92)

This commit is contained in:
Jamison Lofthouse 2021-04-08 15:18:05 -06:00 committed by GitHub
parent 663d3b9a5f
commit a41231675f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,10 +71,12 @@ Endpoint = {{hostvars[host].wireguard_endpoint}}:{{hostvars[host].wireguard_port
{% else %}
Endpoint = {{host}}:{{hostvars[host].wireguard_port}}
{% endif %}
{% elif hostvars[host].wireguard_endpoint is defined and hostvars[host].wireguard_endpoint != "" %}
{% elif hostvars[host].wireguard_endpoint is defined %}
{% if hostvars[host].wireguard_endpoint != "" %}
Endpoint = {{hostvars[host].wireguard_endpoint}}:{{wireguard_port}}
{% elif hostvars[host].wireguard_endpoint == "" %}
{% else %}
# No endpoint defined for this peer
{% endif %}
{% else %}
Endpoint = {{host}}:{{wireguard_port}}
{% endif %}