From e1138ebaad5a3bd5d1c6cd5a91e27826a169aeda Mon Sep 17 00:00:00 2001 From: Salt Date: Mon, 28 Feb 2022 15:22:38 -0600 Subject: [PATCH] Check to ensure vars.tags is defined in Nagios template --- roles/nagios/templates/nagios-ansible-inventory.cfg.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/nagios/templates/nagios-ansible-inventory.cfg.j2 b/roles/nagios/templates/nagios-ansible-inventory.cfg.j2 index 824c21f..52bc7bd 100644 --- a/roles/nagios/templates/nagios-ansible-inventory.cfg.j2 +++ b/roles/nagios/templates/nagios-ansible-inventory.cfg.j2 @@ -139,6 +139,7 @@ define hostgroup { # Inventory Hosts and related services {% for host in groups['tags_nagios'] %} {% set vars = hostvars[host] %} +{% if vars.tags is defined %} define host { use ansible-linux-server host_name {{ host }} @@ -213,4 +214,5 @@ define service { {# #} {% endfor %} {% endfor %} +{% endif %} {% endfor %}