diff --git a/inventory/group_vars/nagios-new b/inventory/group_vars/nagios-new index fc13bc1a51..1d720e4b6e 100644 --- a/inventory/group_vars/nagios-new +++ b/inventory/group_vars/nagios-new @@ -163,3 +163,43 @@ phx2_management_slowping: - ppc8-01-fsp.mgmt.fedoraproject.org - ppc8-02-fsp.mgmt.fedoraproject.org - ppc8-03-fsp.mgmt.fedoraproject.org + +phx2_external: + - bastion01.fedoraproject.org + - bastion02.fedoraproject.org + - pkgs.fedoraproject.org + - stg.fedoraproject.org + - puppet.fedoraproject.org + - koji.fedoraproject.org + - secondary1.fedoraproject.org + - autoqa-stg.fedoraproject.org + - kojipkgs.fedoraproject.org + - pkgs.stg.fedoraproject.org + - bastion-comm01.fedoraproject.org + - admin.stg.fedoraproject.org + - proxy10.fedoraproject.org + - proxy01.fedoraproject.org + - ns04.fedoraproject.org + - s390.koji.fedoraproject.org + - koji.stg.fedoraproject.org + - ppc.koji.fedoraproject.org + - dl01.fedoraproject.org + - dl02.fedoraproject.org + - dl03.fedoraproject.org + - dl04.fedoraproject.org + - dl05.fedoraproject.org + - retrace01.fedoraproject.org + - autoqa.fedoraproject.org + - qadevel.fedoraproject.org + - arm.koji.fedoraproject.org + - fas.fedoraproject.org + - ppc-composer.qa.fedoraproject.org + - retrace02.fedoraproject.org + - noc01.fedoraproject.org + - aarch64.koji.fedoraproject.org + - beaker.fedoraproject.org + - master.centos.org + - ppc-le.koji.fedoraproject.org + - qadevel-stg.fedoraproject.org + - qadevel-stg.qa.fedoraproject.org + - centos02-phx.centos.org diff --git a/roles/nagios_server/tasks/main.yml b/roles/nagios_server/tasks/main.yml index 6756293aad..fc5525275b 100644 --- a/roles/nagios_server/tasks/main.yml +++ b/roles/nagios_server/tasks/main.yml @@ -169,7 +169,7 @@ notify: restart nagios ## Copy over the services -- name: Copy /etc/nagios/services (production) +- name: Copy /etc/nagios/services (PHX2) copy: src=nagios/services/{{ item }} dest=/etc/nagios/services/{{ item }} with_items: - autocloud.cfg @@ -200,14 +200,40 @@ - ssh.cfg - ssl.cfg - swap.cfg + - templates.cfg - unbound.cfg - vpnclients.cfg - websites.cfg - - templates.cfg tags: - nagios-config - nagios_server - when: env == "production" + when: env == "production" and location == "internal" + notify: restart nagios + +## Copy over the services +- name: Copy /etc/nagios/services (External) + copy: src=nagios/services/{{ item }} dest=/etc/nagios/services/{{ item }} + with_items: + - copr.cfg + - db_backups.cfg + - dns.cfg + - haproxy.cfg + - mail_queue.cfg + - pagure_redis.cfg + - ping.cfg + - procs.cfg + - raid.cfg + - smtp-mm.cfg + - ssh.cfg + - ssl.cfg + - swap.cfg + - templates.cfg + - unbound.cfg + - websites.cfg + tags: + - nagios-config + - nagios_server + when: env == "production" and location == "external" notify: restart nagios ## Copy over the services @@ -229,6 +255,7 @@ tags: - nagios-config - nagios_server + when: location == "internal" notify: restart nagios ## Copy over the plugins @@ -284,12 +311,11 @@ - coloamer-hosts.cfg - dedicatedsolutions-hosts.cfg - host1plus-hosts.cfg + - gateway-hosts.cfg - ibiblio-hosts.cfg - internetx-hosts.cfg - osuosl-hosts.cfg - - phx2-hosts.cfg - - staging-hosts.cfg - - phx2-mgmt-hosts.cfg + - other.cfg - rdu-cc-hosts.cfg - rdu-hosts.cfg - tummy-hosts.cfg @@ -297,6 +323,27 @@ tags: - nagios_server +## These are only available to the internal server +- name: Build out nagios host templates (production) + template: src=nagios/hosts/{{item}}.j2 dest=/etc/nagios/hosts/{{item}} mode=0644 owner=root group=root + with_items: + - phx2-hosts.cfg + - phx2-mgmt-hosts.cfg + - staging-hosts.cfg + when: env == "production" and nagios_location == "internal" + tags: + - nagios_server + +- name: Build out nagios host templates (production) + template: src=nagios/hosts/{{item}}.j2 dest=/etc/nagios/hosts/{{item}} mode=0644 owner=root group=root + with_items: + - phx2-external.cfg + when: env == "production" and nagios_location == "external" + tags: + - nagios_server + + + - name: Build out nagios host templates (staging) template: src=nagios/hosts/{{item}}.j2 dest=/etc/nagios/hosts/{{item}} mode=0644 owner=root group=root with_items: @@ -314,6 +361,15 @@ - vpnclients.cfg - nomail.cfg - checkswap.cfg + when: nagios_location == "internal" + tags: + - nagios_server + +- name: Build out nagios hostgroup templates + template: src=nagios/hostgroups/{{item}}.j2 dest=/etc/nagios/hostgroups/{{item}} mode=0644 owner=root group=root + with_items: + - all-external.cfg + when: nagios_location == "external" tags: - nagios_server @@ -329,6 +385,7 @@ - ipa.cfg - mgmt-http.cfg - mirrorlist.cfg + when: nagios_location == "internal" tags: - nagios_server diff --git a/roles/nagios_server/templates/nagios/hostgroups/all-external.cfg.j2 b/roles/nagios_server/templates/nagios/hostgroups/all-external.cfg.j2 new file mode 100644 index 0000000000..fbbd363c50 --- /dev/null +++ b/roles/nagios_server/templates/nagios/hostgroups/all-external.cfg.j2 @@ -0,0 +1,11 @@ +define hostgroup { + hostgroup_name dnsservers + alias DNS Servers + members {% for host in groups["dns"] %}{{ inventory_hostname_short }}.fedoraproject.org, {% endfor %} +} + +define hostgroup { + hostgroup_name proxies + alias Web Servers + members {% for host in groups["proxies"] %}{{ inventory_hostname_short }}.fedoraproject.org, {% endfor %} +} diff --git a/roles/nagios_server/files/nagios/hosts/gateway-hosts.cfg b/roles/nagios_server/templates/nagios/hosts/gateway-hosts.cfg.j2 similarity index 72% rename from roles/nagios_server/files/nagios/hosts/gateway-hosts.cfg rename to roles/nagios_server/templates/nagios/hosts/gateway-hosts.cfg.j2 index ba103ca0a2..b004ac774b 100644 --- a/roles/nagios_server/files/nagios/hosts/gateway-hosts.cfg +++ b/roles/nagios_server/templates/nagios/hosts/gateway-hosts.cfg.j2 @@ -7,7 +7,13 @@ define host { alias PHX2 Router use mincheck check_command check-host-alive +{% if vars['nagios_location'] == 'internal' %} address 10.5.126.254 +{% else %} + address 66.187.228.248 +{% endif %} + + address } #'ibiblio' @@ -17,7 +23,11 @@ define host { use mincheck check_command check-host-alive address 152.19.134.129 +{% if vars['nagios_location'] == 'internal' %} parents phx2-gw +{% else %} +{% endif %} + } define host { @@ -26,7 +36,11 @@ define host { use mincheck check_command check-host-alive address 209.132.184.254 +{% if vars['nagios_location'] == 'internal' %} parents phx2-gw +{% else %} + parents ibiblio-gw +{% endif %} } define host { @@ -35,7 +49,12 @@ define host { use mincheck check_command check-host-alive address 174.141.234.1 +{% if vars['nagios_location'] == 'internal' %} parents phx2-gw +{% else %} + parents ibiblio-gw +{% endif %} + } define host { @@ -44,7 +63,12 @@ define host { use mincheck check_command check-host-alive address 67.203.2.65 +{% if vars['nagios_location'] == 'internal' %} parents phx2-gw +{% else %} + parents ibiblio-gw +{% endif %} + } #'dedicatedsolutions' @@ -54,7 +78,12 @@ define host { use mincheck check_command check-host-alive address 67.219.144.65 +{% if vars['nagios_location'] == 'internal' %} parents phx2-gw +{% else %} + parents ibiblio-gw +{% endif %} + } #'host1plus' @@ -64,7 +93,12 @@ define host { use mincheck check_command check-host-alive address 185.141.164.1 +{% if vars['nagios_location'] == 'internal' %} parents phx2-gw +{% else %} + parents ibiblio-gw +{% endif %} + } #'internetx' @@ -74,7 +108,12 @@ define host { use mincheck check_command check-host-alive address 85.236.55.1 +{% if vars['nagios_location'] == 'internal' %} parents phx2-gw +{% else %} + parents ibiblio-gw +{% endif %} + } # 'osuosl' @@ -84,7 +123,12 @@ define host { use mincheck check_command check-host-alive address 140.211.169.193 +{% if vars['nagios_location'] == 'internal' %} parents phx2-gw +{% else %} + parents ibiblio-gw +{% endif %} + } #'rdu' @@ -94,7 +138,12 @@ define host { use mincheck check_command check-host-alive address 128.109.70.198 +{% if vars['nagios_location'] == 'internal' %} parents phx2-gw +{% else %} + parents ibiblio-gw +{% endif %} + } #'rdu-cc' @@ -104,7 +153,12 @@ define host { use mincheck check_command check-host-alive address 8.43.85.254 +{% if vars['nagios_location'] == 'internal' %} parents phx2-gw +{% else %} + parents ibiblio-gw +{% endif %} + } #'tummy' @@ -114,7 +168,12 @@ define host { use mincheck check_command check-host-alive address 66.35.62.174 +{% if vars['nagios_location'] == 'internal' %} parents phx2-gw +{% else %} + parents ibiblio-gw +{% endif %} + } diff --git a/roles/nagios_server/files/nagios/hosts/other.cfg b/roles/nagios_server/templates/nagios/hosts/other.cfg.j2 similarity index 69% rename from roles/nagios_server/files/nagios/hosts/other.cfg rename to roles/nagios_server/templates/nagios/hosts/other.cfg.j2 index d88cce7e27..0f941c0fdd 100644 --- a/roles/nagios_server/files/nagios/hosts/other.cfg +++ b/roles/nagios_server/templates/nagios/hosts/other.cfg.j2 @@ -3,5 +3,9 @@ define host { alias status-fedora2.rhcloud.com use mincheck address status-fedora2.rhcloud.com +{% if vars['nagios_location'] == 'internal' %} parents phx2-gw +{% else %} + parents ibiblio-gw +{% endif %} } diff --git a/roles/nagios_server/templates/nagios/hosts/phx2-external.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/phx2-external.cfg.j2 new file mode 100644 index 0000000000..679ba729a7 --- /dev/null +++ b/roles/nagios_server/templates/nagios/hosts/phx2-external.cfg.j2 @@ -0,0 +1,9 @@ +{% for host in vars['phx2_external'] %} +define host { + host_name {{ host }} + alias {{ host }} + use mincheck + address {{ host }} + parents phx2-gw +} +{% endfor %} diff --git a/roles/nagios_server/templates/nagios/hosts/phx2-mgmt-hosts.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/phx2-mgmt-hosts.cfg.j2 index af5e6a90c0..8d10714ae7 100644 --- a/roles/nagios_server/templates/nagios/hosts/phx2-mgmt-hosts.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hosts/phx2-mgmt-hosts.cfg.j2 @@ -1,10 +1,10 @@ {% for host in vars['phx2_management_hosts'] %} define host { host_name {{ host }} - alias {{ host }} - use mincheck - address {{ host }} - parents phx2-gw + alias {{ host }} + use mincheck + address {{ host }} + parents phx2-gw } {% endfor %} @@ -14,10 +14,10 @@ define host { {% for host in vars['phx2_management_limited'] %} define host { host_name {{ host }} - alias {{ host }} - use mincheck - address {{ host }} - parents phx2-gw + alias {{ host }} + use mincheck + address {{ host }} + parents phx2-gw } {% endfor %} diff --git a/vars/nagios.noc01.yml b/vars/nagios.noc01.yml index 55868f71fc..c435e55134 100644 --- a/vars/nagios.noc01.yml +++ b/vars/nagios.noc01.yml @@ -1,2 +1,3 @@ --- nagios_srcdir: 'nagios' +nagios_location: 'internal' diff --git a/vars/nagios.noc02.yml b/vars/nagios.noc02.yml index c10331cc8d..4d96cd787e 100644 --- a/vars/nagios.noc02.yml +++ b/vars/nagios.noc02.yml @@ -1,2 +1,3 @@ --- nagios_srcdir: 'nagios-external' +nagios_location: 'external'