ansible/roles/nagios_server/templates/nagios/hosts/osuosl-hosts.cfg.j2
2017-01-08 22:42:45 +00:00

27 lines
950 B
Django/Jinja

{% for host in groups['all'] %}
{% if hostvars[host].datacenter == 'osuosl' %}
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 osuosl-gw
{% endif %}
}
{% endif %}
{% endfor %}