diff --git a/templates/wireguard_client.conf b/templates/wireguard_client.conf index 09becca..3d94c65 100644 --- a/templates/wireguard_client.conf +++ b/templates/wireguard_client.conf @@ -5,7 +5,7 @@ ListenPort = {{ listenport }} {% if vpn_dns is defined %}DNS = {{ vpn_dns }}{% endif %} # 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] PublicKey = {{ hostvars[item]['PublicKey'] }}