diff --git a/roles/nagios/templates/hosts.cfg b/roles/nagios/templates/hosts.cfg index afd26b2..42354ae 100644 --- a/roles/nagios/templates/hosts.cfg +++ b/roles/nagios/templates/hosts.cfg @@ -1,35 +1,35 @@ define host{ name linux-box use generic-host check_period 24x7 check_interval 5 retry_interval 1 max_check_attempts 10 check_command check-host-alive notification_period 24x7 notification_interval 30 notification_options d,r contact_groups c4science_admins register 0 } {% for group in groups.keys() %} {% if group not in ['all', 'ungrouped'] %} {% for host in groups[group] %} define host{ use linux-box host_name {{ hostvars[host]['host_name'] }} - {% if host == '{{ external_ip }}' %} + {% if host == external_ip %} address {{ internal_ip }} {% else %} address {{ host }} + {% endif %} {% if group not in ['lbs', 'monit', 'backup'] %} hostgroups {{ group }} {% else %} hostgroups utils {% endif %} } - {% endif %} {% endfor %} {% endif %} {% endfor %}