diff --git a/roles/nagios_server/templates/nagios/hostgroups/vpnclients.cfg.j2 b/roles/nagios_server/templates/nagios/hostgroups/vpnclients.cfg.j2 index 65896824e9..1c7ea6d35c 100644 --- a/roles/nagios_server/templates/nagios/hostgroups/vpnclients.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hostgroups/vpnclients.cfg.j2 @@ -3,6 +3,6 @@ define hostgroup { hostgroup_name vpnclients alias vpnclients - members {% for host in groups['all'] %}{% if hostvars[host].vpn and (hostvars[host].nagios_NoCheck_Services['vpn'] == true) %}{{host}},{% endif %} {% endfor %} + members {% for host in groups['all'] %}{% if ( hostvars[host].vpn is defined ) and (hostvars[host].nagios_NoCheck_Services['vpn'] == true) %}{{host}},{% endif %} {% endfor %} }