Files
fedora-infra_ansible/roles/nagios_server/templates/nagios/hosts/rdu3-hosts.cfg.j2
Kevin Fenzi b6a7d5edfd nagios: try and rework conditional
Signed-off-by: Kevin Fenzi <kevin@scrye.com>
2026-02-16 10:23:01 -08:00

30 lines
1.1 KiB
Django/Jinja

{% for host in groups['all']|sort %}
{% if hostvars[host].datacenter.startswith('rdu3') and hostvars[host].nagios_Can_Connect == true %}
define host {
{% if hostvars[host].nagios_Check_Services['nrpe'] == true %}
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_ipv4_ip is defined %}
address {{ hostvars[host].eth0_ipv4_ip }}
{% elif hostvars[host].ansible_default_ipv4 is defined and hostvars[host].ansible_default_ipv4.address is defined %}
address {{ hostvars[host].ansible_default_ipv4.address }}
{% else %}
address {{ host }}
{% endif %}
{% if hostvars[host]['vmhost'] is defined %}
parents {{ hostvars[host]['vmhost'] }}
{% else %}
parents rdu3-gw
{% endif %}
}
{% endif %}
{% endfor %}