ansible/roles/nagios_server/templates/nagios/hosts/cloud-hosts.cfg.j2
Rick Elrod ab87b7ceb5 Try vars['nagios_location'] instead of nagios_location
Signed-off-by: Rick Elrod <relrod@redhat.com>
2018-06-27 22:40:10 +00:00

32 lines
1.2 KiB
Django/Jinja

{% for host in groups['cloud']|sort %}
{% if host.startswith('copr') and vars['nagios_location'] == 'external' %}
{% else %}
define host {
{% if hostvars[host].nagios_Check_Services['nrpe'] and vars['nagios_location'] == 'internal' %}
use defaulttemplate
{% else %}
use mincheck
{% endif %}
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 and host not in groups['cloud'] %}
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 cloud-gw
{% endif %}
}
{% endif %}
{% endfor %}