From 4678df47bebd10870a354cbd4bdbde0b8b46c2b1 Mon Sep 17 00:00:00 2001 From: Stephen Smoogen Date: Mon, 9 Jan 2017 00:03:51 +0000 Subject: [PATCH] some phx2 boxes are staging. some are not --- .../nagios/hosts/staging-hosts.cfg.j2 | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 roles/nagios_server/templates/nagios/hosts/staging-hosts.cfg.j2 diff --git a/roles/nagios_server/templates/nagios/hosts/staging-hosts.cfg.j2 b/roles/nagios_server/templates/nagios/hosts/staging-hosts.cfg.j2 new file mode 100644 index 0000000000..4373a56c4d --- /dev/null +++ b/roles/nagios_server/templates/nagios/hosts/staging-hosts.cfg.j2 @@ -0,0 +1,27 @@ +{% for host in groups['all'] %} +{% if hostvars[host].datacenter == 'staging' %} +define host { + use defaulttemplate + host_name {{ host }} +{% if hostvars[host].ansible_hostname is defined %} + alias {{ hostvars[host].ansible_hostname }} +{% else %} + alias {{ host }} +{% endif %} +{% if hostvars[host].eth0_ip is defined %} + address {{ hostvars[host].eth0_ip }} +{% elif hostvars[host].ansible_default_ipv4 is defined %} +{% if hostvars[host].ansible_default_ipv4.address is defined %} + address {{ hostvars[host].ansible_default_ipv4.address }} +{% endif %} +{% else %} + address {{ host }} +{% endif %} +{% if hostvars[host]['vmhost'] is defined %} + parents {{ hostvars[host]['vmhost'] }} +{% elif hostvars[host].datacenter is defined %} + parents phx2-gw +{% endif %} +} +{% endif %} +{% endfor %}