From 224eb7a3f4a80870464198434626906e5a75ac5d Mon Sep 17 00:00:00 2001 From: Stephen Smoogen Date: Feb 26 2020 22:05:12 +0000 Subject: move the ping test to its own variable --- diff --git a/inventory/group_vars/all b/inventory/group_vars/all index 0faf0d2..f862897 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 54dddc5..7b72fa4 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 db8de34..63d5728 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 b2fab1f..251e073 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 ed5e79b..ecacd12 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 adefe9a..08e1489 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 2fb41cd..a811d46 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 6a2d1d0..cb35d71 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 6e2b394..6ad99b8 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 e9887be..a652b02 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 e8bd258..a010a17 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 f476dc2..84df542 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 a2f3c21..913b5da 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