nagios: allow empty non-member groups
This is mostly to fix the ansible-playbook failure `nagios -v /etc/nagios/nagios.cfg` if `member` is empty.
This commit is contained in:
parent
4cfcfcc4d8
commit
01129c2be3
2 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
hostbase: copr-pulp-
|
hostbase: copr-pulp-
|
||||||
# This instance is WIP and we don't want nagios alerts yet
|
# This instance is WIP and we don't want nagios alerts yet
|
||||||
nagios_Can_Connect: false
|
nagios_Can_Connect: true
|
||||||
nagios_Check_Services:
|
nagios_Check_Services:
|
||||||
dhcpd: false
|
dhcpd: false
|
||||||
httpd: false
|
httpd: false
|
||||||
|
|
|
@ -7,8 +7,10 @@
|
||||||
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 %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue