From 28ba173acb70aeb77c661a828e602beaeba34490 Mon Sep 17 00:00:00 2001 From: Stephen Smoogen Date: Wed, 1 Jul 2020 17:40:02 -0400 Subject: [PATCH] move the dns_external check to using a group variable in the nagios group. This takes it out of the main inventory where its names do not match and this other group was not used in any other playbook --- inventory/group_vars/nagios | 7 +++++++ inventory/inventory | 6 ------ .../templates/nagios/hostgroups/all-external.cfg.j2 | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/inventory/group_vars/nagios b/inventory/group_vars/nagios index 182f8ea78b..bd0129d167 100644 --- a/inventory/group_vars/nagios +++ b/inventory/group_vars/nagios @@ -105,6 +105,13 @@ iad2_external: - retrace01.fedoraproject.org - secondary01.fedoraproject.org +dns_external: + - ns-iad01.fedoraproject.org + - ns-iad02.fedoraproject.org + - ns02.fedoraproject.org + - ns05.fedoraproject.org + + # When you have a group which comes up with empty members in all.cfg, it # is because it contains all hosts which aren't pinganble. You may want # to add that group to this list. Other items on this list are ones diff --git a/inventory/inventory b/inventory/inventory index dbf6f40015..b1a9e3f5bf 100644 --- a/inventory/inventory +++ b/inventory/inventory @@ -392,12 +392,6 @@ ns02.fedoraproject.org ns05.fedoraproject.org ns13.rdu2.fedoraproject.org -[dns_external] -ns-iad01.iad2.fedoraproject.org -ns-iad02.iad2.fedoraproject.org -ns02.fedoraproject.org -ns05.fedoraproject.org - [odcs_frontend] odcs-frontend01.iad2.fedoraproject.org diff --git a/roles/nagios_server/templates/nagios/hostgroups/all-external.cfg.j2 b/roles/nagios_server/templates/nagios/hostgroups/all-external.cfg.j2 index 9a284fa0af..8d8401f5d4 100644 --- a/roles/nagios_server/templates/nagios/hostgroups/all-external.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hostgroups/all-external.cfg.j2 @@ -1,7 +1,7 @@ define hostgroup { hostgroup_name dns alias DNS Servers - members {% for host in groups["dns_external"]|sort %} {{ hostvars[host]["inventory_hostname_short"] }}.fedoraproject.org {% if not loop.last %}, {% endif %} {% endfor %} + members {% for host in vars['dns_external']|sort %}{{ host }}{% if not loop.last %}, {% endif %} {% endfor %} }