ansible/roles/nagios_server/templates/nagios/hosts/ibiblio-hosts-ipv6.cfg.j2
Pavel Raiskup 5adeb88890 nagios: do not rely on ansible_hostname defined for the ipv6 checks
Changing the `host_name` - it was a "fake" non-DNS address anyway
Specify aliases only if ansible_hostname is stated in cached facts,
see https://pagure.io/fedora-infrastructure/issue/11264
2023-04-26 08:22:02 +02:00

32 lines
1.2 KiB
Django/Jinja

## This template currently only works for noc02. If noc01 gets ipv6 then
## it will need to be revisited.
{% for host in groups['all']|sort if
hostvars[host].datacenter == 'ibiblio' and
hostvars[host].nagios_Can_Connect == true
%}
define host {
use mincheck6
host_name ipv6-{{ host }}
{% if hostvars[host].ansible_hostname is defined %}
alias {{ hostvars[host].ansible_hostname }}-ipv6.fedoraproject.org
alias {{ hostvars[host].ansible_hostname }}-ipv6
{% else %}
alias {{ host }}
{% endif %}
{% if hostvars[host].eth0_ipv6_ip is defined %}
address {{ hostvars[host].eth0_ipv6_ip }}
{% elif hostvars[host].ansible_default_ipv6 is defined %}
{% if hostvars[host].ansible_default_ipv6.address is defined %}
address {{ hostvars[host].ansible_default_ipv6.address }}
{% endif %}
{% else %}
address {{ host }}
{% endif %}
{% if hostvars[host]['vmhost'] is defined %}
parents {{ hostvars[host]['vmhost'] }}
{% elif hostvars[host].datacenter is defined %}
parents ibiblio-gw
{% endif %}
}
{% endfor %}