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 %}
|
||||
{% if groups[key] != [] and key.startswith('copr') %}
|
||||
define hostgroup{
|
||||
define hostgroup {
|
||||
hostgroup_name {{ 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 %}
|
||||
{% endfor %}
|
||||
|
|
|
@ -7,11 +7,10 @@
|
|||
define hostgroup{
|
||||
hostgroup_name {{ key }}
|
||||
alias {{ key }}
|
||||
{% for host in groups[key]|sort if hostvars[host].nagios_Can_Connect == true %}
|
||||
{% if loop.first %}
|
||||
{%- for host in groups[key]|sort if hostvars[host].nagios_Can_Connect == true %}
|
||||
{% if loop.first +%}
|
||||
members {{ host }}{% else %}, {{ host }}{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% endfor +%}
|
||||
}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue