zabbix: add hosts to hostgroup prior to template creation

move linking to template to separate task

Signed-off-by: David Kirwan <davidkirwanirl@gmail.com>
This commit is contained in:
David Kirwan 2024-02-13 13:05:40 +00:00
parent f340a11c88
commit 2f566d3c9a
No known key found for this signature in database
GPG key ID: A5893AB6474AC37D
3 changed files with 17 additions and 3 deletions

View file

@ -3,7 +3,7 @@
community.zabbix.zabbix_host:
host_name: "{{ inventory_hostname }}"
host_groups: "{{ item['hostgroup']}}"
link_templates: "{{ item['template'] }}"
# link_templates: "{{ item['template'] }}"
force: false
with_items: "{{ zabbix_templates }}"
tags:

View file

@ -0,0 +1,10 @@
---
- name: Add templates to hosts
community.zabbix.zabbix_host:
host_name: "{{ inventory_hostname }}"
host_groups: "{{ item['hostgroup']}}"
link_templates: "{{ item['template'] }}"
force: false
with_items: "{{ zabbix_templates }}"
tags:
- zabbix_add_templates_to_hosts

View file

@ -16,10 +16,14 @@
tags:
- zabbix_hostgroups
- include_tasks: add_hosts_to_hostgroups.yml
tags:
- zabbix_add_hosts_to_hostgroups
- include_tasks: templates.yml
tags:
- zabbix_templates
- include_tasks: add_hosts_to_hostgroups.yml
- include_tasks: add_templates_to_hosts.yml
tags:
- zabbix_add_hosts_to_hostgroups
- zabbix_add_templates_to_hosts