Don't change the template name, or it will be the name of the remote file

Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
This commit is contained in:
Aurélien Bompard
2025-06-23 10:27:03 +02:00
parent b8fea68959
commit 9007df7619
2 changed files with 3 additions and 3 deletions

View File

@@ -498,10 +498,10 @@
- nagios_config
notify: Restart nagios
- name: Build out nagios hostgroup templates (iad2)
- name: Build out nagios hostgroup templates
ansible.builtin.template: src=nagios/hostgroups/{{item}}.j2 dest=/etc/nagios/hostgroups/{{item}} mode=0644 owner=root group=root
with_items:
- "all.cfg.{{datacenter}}"
- all.cfg
- vpnclients.cfg
- nomail.cfg
- checkswap.cfg

View File

@@ -7,7 +7,7 @@
define hostgroup{
hostgroup_name {{ key }}
alias {{ key }}
{%- for host in groups[key]|sort if hostvars[host].nagios_Can_Connect == true and hostvars[host].datacenter == 'iad2' %}
{%- for host in groups[key]|sort if hostvars[host].nagios_Can_Connect == true and '.iad2.' in hostvars[host].inventory_hostname %}
{% if loop.first +%}
members {{ host }}{% else %}, {{ host }}{% endif %}
{% endfor +%}