---
#- name: Get Zabbix template as JSON
#  community.zabbix.zabbix_template_info:
#    template_name: fedora releng compose cronjobs
#    format: json
#    omit_date: yes
#  register: zabbix_template_json

#- name: Write Zabbix templte to JSON file
#  local_action:
#    module: copy
#    content: "{{ zabbix_template_json['template_json'] }}"
#    dest: "roles/zabbix_server/files/zabbix_templates/releng_compose_cronjobs.json"

- name: Import Zabbix templates from JSON
  community.zabbix.zabbix_template:
    template_json: "{{ lookup('file', item['template'] ) }}"
    state: present
  with_items: "{{ zabbix_templates }}" # Templates specific to an ansible group, can be overwridden in inventory/group_vars/group_name
  tags:
    - zabbix_templates
