nagios: fix empty groups members in all-external.cfg.j2
This commit is contained in:
parent
5adeb88890
commit
56c3f11a48
2 changed files with 8 additions and 7 deletions
|
@ -35,11 +35,13 @@ define hostgroup {
|
||||||
|
|
||||||
{% for key, value in groups.items()|sort %}
|
{% for key, value in groups.items()|sort %}
|
||||||
{% if groups[key] != [] and key.startswith('copr') %}
|
{% if groups[key] != [] and key.startswith('copr') %}
|
||||||
define hostgroup{
|
define hostgroup {
|
||||||
hostgroup_name {{ key }}
|
hostgroup_name {{ key }}
|
||||||
alias {{ key }}
|
alias {{ key }}
|
||||||
members {% for host in groups[key]|sort %}{% if hostvars[host].nagios_Can_Connect == true %}{{host}}, {% endif %}{% endfor %}
|
{%- for host in groups[key]|sort if hostvars[host].nagios_Can_Connect == true %}
|
||||||
|
{% if loop.first +%}
|
||||||
|
members {{ host }}{% else %}, {{ host }}{% endif %}
|
||||||
|
{% endfor +%}
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -7,11 +7,10 @@
|
||||||
define hostgroup{
|
define hostgroup{
|
||||||
hostgroup_name {{ key }}
|
hostgroup_name {{ key }}
|
||||||
alias {{ key }}
|
alias {{ key }}
|
||||||
{% for host in groups[key]|sort if hostvars[host].nagios_Can_Connect == true %}
|
{%- for host in groups[key]|sort if hostvars[host].nagios_Can_Connect == true %}
|
||||||
{% if loop.first %}
|
{% if loop.first +%}
|
||||||
members {{ host }}{% else %}, {{ host }}{% endif %}
|
members {{ host }}{% else %}, {{ host }}{% endif %}
|
||||||
{% endfor %}
|
{% endfor +%}
|
||||||
|
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue