Add check for empty pubkey

This commit is contained in:
Antonio J. Delgado 2024-05-19 13:53:47 +03:00
parent 0dff9058ef
commit a46b6fa428

View file

@ -5,7 +5,7 @@ ListenPort = {{ listenport }}
{% if vpn_dns is defined %}DNS = {{ vpn_dns }}{% endif %} {% if vpn_dns is defined %}DNS = {{ vpn_dns }}{% endif %}
# From inventory # From inventory
{% for item in groups['wireguard_clients'] %}{% if hostvars[item]['inventory_hostname'] != inventory_hostname and 'PublicKey' in hostvars[item] and 'AllowedIPs' in hostvars[item] %} {% for item in groups['wireguard_clients'] %}{% if hostvars[item]['inventory_hostname'] != inventory_hostname and 'PublicKey' in hostvars[item] and 'AllowedIPs' in hostvars[item] and hostvars[item]['PublicKey'] != ""%}
# Peer name: {{ item }} # Peer name: {{ item }}
[Peer] [Peer]
PublicKey = {{ hostvars[item]['PublicKey'] }} PublicKey = {{ hostvars[item]['PublicKey'] }}