diff --git a/roles/nagios_server/templates/nagios/hostgroups/all.cfg.j2 b/roles/nagios_server/templates/nagios/hostgroups/all.cfg.j2 index c0f625a8b8..484abf6da4 100644 --- a/roles/nagios_server/templates/nagios/hostgroups/all.cfg.j2 +++ b/roles/nagios_server/templates/nagios/hostgroups/all.cfg.j2 @@ -3,16 +3,28 @@ ############### ## {{ env }} -{% for key, value in groups.iteritems() %} -{% if groups[key] %} +{% if env == "staging" %} define hostgroup{ - hostgroup_name {{ key }} - alias {{ key }} - members {% for host in groups[key] %}{% if (hostvars[host].env is defined) and (hostvars[host].env == 'staging') %} {{host}}, {% endif %} {% endfor %} + hostgroup_name all + alias all + members {% for host in groups['all'] %}{% if (hostvars[host].env is defined) and (hostvars[host].env == 'staging') %} {{host}}, {% endif %} {% endfor %} } {% endif %} {% endfor %} +{% else %} +{% for key, value in groups.iteritems() %} +{% if groups[key] %} +define hostgroup{ + hostgroup_name {{ key }} + alias {{ key }} + members {% for host in groups[key] %}{{host}}, {% endfor %} + +} +{% endfor %} + + +{% endif %}