Check to ensure vars.tags is defined in Nagios template

This commit is contained in:
Salt 2022-02-28 15:22:38 -06:00
parent d3ccfe8336
commit e1138ebaad

View File

@ -139,6 +139,7 @@ define hostgroup {
# Inventory Hosts and related services # Inventory Hosts and related services
{% for host in groups['tags_nagios'] %} {% for host in groups['tags_nagios'] %}
{% set vars = hostvars[host] %} {% set vars = hostvars[host] %}
{% if vars.tags is defined %}
define host { define host {
use ansible-linux-server use ansible-linux-server
host_name {{ host }} host_name {{ host }}
@ -213,4 +214,5 @@ define service {
{# #} {# #}
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
{% endif %}
{% endfor %} {% endfor %}