From f963dfa4d5930e0a66a5e8cb4f937e9873226c53 Mon Sep 17 00:00:00 2001 From: Stephen Smoogen Date: Wed, 26 Feb 2020 22:05:12 +0000 Subject: [PATCH] move the ping test to its own variable --- inventory/group_vars/all | 2 ++ inventory/host_vars/batcave13.rdu2.fedoraproject.org | 2 ++ inventory/host_vars/ns13.rdu2.fedoraproject.org | 2 ++ roles/nagios_server/templates/nagios/hostgroups/all.cfg.j2 | 4 ++-- .../nagios_server/templates/nagios/hosts/bodhost-hosts.cfg.j2 | 2 +- .../templates/nagios/hosts/dedicatedsolutions-hosts.cfg.j2 | 2 +- .../templates/nagios/hosts/host1plus-hosts.cfg.j2 | 2 +- .../nagios_server/templates/nagios/hosts/ibiblio-hosts.cfg.j2 | 2 +- .../nagios_server/templates/nagios/hosts/osuosl-hosts.cfg.j2 | 2 +- roles/nagios_server/templates/nagios/hosts/phx2-hosts.cfg.j2 | 2 +- .../nagios_server/templates/nagios/hosts/rdu-cc-hosts.cfg.j2 | 2 +- roles/nagios_server/templates/nagios/hosts/rdu-hosts.cfg.j2 | 2 +- .../nagios_server/templates/nagios/hosts/staging-hosts.cfg.j2 | 2 +- 13 files changed, 17 insertions(+), 11 deletions(-) diff --git a/inventory/group_vars/all b/inventory/group_vars/all index 0faf0d2ad3..f862897cd9 100644 --- a/inventory/group_vars/all +++ b/inventory/group_vars/all @@ -372,6 +372,8 @@ nagios_Check_Services: ping: true raid: false +nagios_Can_Connect: true + # Set variable if we want to use our global iptables defaults # Some things need to set their own. baseiptables: True diff --git a/inventory/host_vars/batcave13.rdu2.fedoraproject.org b/inventory/host_vars/batcave13.rdu2.fedoraproject.org index 54dddc5115..7b72fa4429 100644 --- a/inventory/host_vars/batcave13.rdu2.fedoraproject.org +++ b/inventory/host_vars/batcave13.rdu2.fedoraproject.org @@ -25,6 +25,8 @@ datacenter: rdu postfix_group: vpn vpn: true +nagios_Can_Connect: false + nagios_Check_Services: mail: false nrpe: false diff --git a/inventory/host_vars/ns13.rdu2.fedoraproject.org b/inventory/host_vars/ns13.rdu2.fedoraproject.org index db8de347ea..63d572832d 100644 --- a/inventory/host_vars/ns13.rdu2.fedoraproject.org +++ b/inventory/host_vars/ns13.rdu2.fedoraproject.org @@ -26,6 +26,8 @@ nrpe_procs_crit: 1400 ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q root@bastion13.fedoraproject.org"' +nagios_Can_Connect: false + nagios_Check_Services: nrpe: false mail: false diff --git a/roles/nagios_server/templates/nagios/hostgroups/all.cfg.j2 b/roles/nagios_server/templates/nagios/hostgroups/all.cfg.j2 index b2fab1f475..251e073dca 100644 --- a/roles/nagios_server/templates/nagios/hostgroups/all.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hostgroups/all.cfg.j2 @@ -7,7 +7,7 @@ define hostgroup{ hostgroup_name {{ key }} alias {{ key }} - members {% for host in groups[key]|sort %}{{host}}, {% endfor %} + members {% for host in groups[key]|sort %}hostvars[host].nagios_Can_Connect == true {{host}}, {% endfor %} } {% endif %} @@ -25,7 +25,7 @@ define hostgroup{ define hostgroup{ hostgroup_name mincheckgrp alias mincheckgrp - members {% for host in groups['all']|sort %}{% if hostvars[host].nagios_Check_Services['nrpe'] != true and hostvars[host].nagios_Check_Services['ping'] == true %}{{host}}, {% endif %}{% endfor %} + members {% for host in groups['all']|sort %}{% if hostvars[host].nagios_Check_Services['nrpe'] != true and hostvars[host].nagios_Can_Connect == true %}{{host}}, {% endif %}{% endfor %} } diff --git a/roles/nagios_server/templates/nagios/hosts/bodhost-hosts.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/bodhost-hosts.cfg.j2 index ed5e79bf64..ecacd12704 100644 --- a/roles/nagios_server/templates/nagios/hosts/bodhost-hosts.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hosts/bodhost-hosts.cfg.j2 @@ -1,5 +1,5 @@ {% for host in groups['all']|sort %} -{% if hostvars[host].datacenter == 'bodhost' and hostvars[host].nagios_Check_Services['ping'] == true %} +{% if hostvars[host].datacenter == 'bodhost' and hostvars[host].nagios_Can_Connect == true %} define host { {% if vars['nagios_location'] == 'internal' %} use defaulttemplate diff --git a/roles/nagios_server/templates/nagios/hosts/dedicatedsolutions-hosts.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/dedicatedsolutions-hosts.cfg.j2 index adefe9ac52..08e1489470 100644 --- a/roles/nagios_server/templates/nagios/hosts/dedicatedsolutions-hosts.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hosts/dedicatedsolutions-hosts.cfg.j2 @@ -1,5 +1,5 @@ {% for host in groups['all']|sort %} -{% if hostvars[host].datacenter == 'dedicatedsolutions' and hostvars[host].nagios_Check_Services['ping'] == true %} +{% if hostvars[host].datacenter == 'dedicatedsolutions' and hostvars[host].nagios_Can_Connect == true %} define host { {% if vars['nagios_location'] == 'internal' %} use defaulttemplate diff --git a/roles/nagios_server/templates/nagios/hosts/host1plus-hosts.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/host1plus-hosts.cfg.j2 index 2fb41cd997..a811d4690c 100644 --- a/roles/nagios_server/templates/nagios/hosts/host1plus-hosts.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hosts/host1plus-hosts.cfg.j2 @@ -1,5 +1,5 @@ {% for host in groups['all']|sort %} -{% if hostvars[host].datacenter == 'host1plus' and hostvars[host].nagios_Check_Services['ping'] == true %} +{% if hostvars[host].datacenter == 'host1plus' and hostvars[host].nagios_Can_Connect == true %} define host { {% if vars['nagios_location'] == 'internal' %} use defaulttemplate diff --git a/roles/nagios_server/templates/nagios/hosts/ibiblio-hosts.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/ibiblio-hosts.cfg.j2 index 6a2d1d0ea1..cb35d711a8 100644 --- a/roles/nagios_server/templates/nagios/hosts/ibiblio-hosts.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hosts/ibiblio-hosts.cfg.j2 @@ -1,5 +1,5 @@ {% for host in groups['all']|sort %} -{% if hostvars[host].datacenter == 'ibiblio' and hostvars[host].nagios_Check_Services['ping'] == true %} +{% if hostvars[host].datacenter == 'ibiblio' and hostvars[host].nagios_Can_Connect == true %} define host { {% if vars['nagios_location'] == 'internal' %} use defaulttemplate diff --git a/roles/nagios_server/templates/nagios/hosts/osuosl-hosts.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/osuosl-hosts.cfg.j2 index 6e2b394e5c..6ad99b8bcb 100644 --- a/roles/nagios_server/templates/nagios/hosts/osuosl-hosts.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hosts/osuosl-hosts.cfg.j2 @@ -1,5 +1,5 @@ {% for host in groups['all']|sort %} -{% if hostvars[host].datacenter == 'osuosl' and hostvars[host].nagios_Check_Services['ping'] == true %} +{% if hostvars[host].datacenter == 'osuosl' and hostvars[host].nagios_Can_Connect == true %} define host { {% if vars['nagios_location'] == 'internal' %} use defaulttemplate diff --git a/roles/nagios_server/templates/nagios/hosts/phx2-hosts.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/phx2-hosts.cfg.j2 index e9887bea8b..a652b02b78 100644 --- a/roles/nagios_server/templates/nagios/hosts/phx2-hosts.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hosts/phx2-hosts.cfg.j2 @@ -1,5 +1,5 @@ {% for host in groups['all']|sort %} -{% if hostvars[host].datacenter == 'phx2' and hostvars[host].nagios_Check_Services['ping'] == true %} +{% if hostvars[host].datacenter == 'phx2' and hostvars[host].nagios_Can_Connect == true %} define host { {% if hostvars[host].nagios_Check_Services['nrpe'] == true %} use defaulttemplate diff --git a/roles/nagios_server/templates/nagios/hosts/rdu-cc-hosts.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/rdu-cc-hosts.cfg.j2 index e8bd258b6c..a010a177d8 100644 --- a/roles/nagios_server/templates/nagios/hosts/rdu-cc-hosts.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hosts/rdu-cc-hosts.cfg.j2 @@ -1,5 +1,5 @@ {% for host in groups['all']|sort %} -{% if hostvars[host].datacenter == 'rdu-cc' and hostvars[host].nagios_Check_Services['ping'] == true %} +{% if hostvars[host].datacenter == 'rdu-cc' and hostvars[host].nagios_Can_Connect == true %} define host { {% if vars['nagios_location'] == 'internal' %} use defaulttemplate diff --git a/roles/nagios_server/templates/nagios/hosts/rdu-hosts.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/rdu-hosts.cfg.j2 index f476dc28f0..84df542090 100644 --- a/roles/nagios_server/templates/nagios/hosts/rdu-hosts.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hosts/rdu-hosts.cfg.j2 @@ -1,5 +1,5 @@ {% for host in groups['all']|sort %} -{% if hostvars[host].datacenter == 'rdu' and hostvars[host].nagios_Check_Services['ping'] == true %} +{% if hostvars[host].datacenter == 'rdu' and hostvars[host].nagios_Can_Connect == true %} define host { {% if vars['nagios_location'] == 'internal' %} use defaulttemplate diff --git a/roles/nagios_server/templates/nagios/hosts/staging-hosts.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/staging-hosts.cfg.j2 index a2f3c216f0..913b5dacc4 100644 --- a/roles/nagios_server/templates/nagios/hosts/staging-hosts.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hosts/staging-hosts.cfg.j2 @@ -1,5 +1,5 @@ {% for host in groups['all']|sort %} -{% if hostvars[host].datacenter == 'staging' and hostvars[host].nagios_Check_Services['ping'] == true %} +{% if hostvars[host].datacenter == 'staging' and hostvars[host].nagios_Can_Connect == true %} define host { {% if hostvars[host].nagios_Check_Services['nrpe'] == true %} use defaulttemplate