Template import problem. Fails on unavailable trigger.
djdejawu opened this issue · comments
Today I've exported a few templates from one Zabbix server to make same in another. This playbook works perfect to save requested template from old one.
---
- name: Dump playbook
hosts: old_zabbix
tasks:
- name: Get zabbix template
community.zabbix.zabbix_template_info:
template_name: AAA_Weather
format: xml
omit_date: true
register: template
- name: Print template
ansible.builtin.debug:
msg: "{{ template.template_xml }}"
- name: Write template to file
delegate_to: localhost
ansible.builtin.copy:
content: "{{ template.template_xml }}"
dest: weather.xml
mode: '0644'
But when I'm trying to import saved template what have a trigger with dependcies it's fails with message what trigger doesn't exist
. Depended trigger in imported XML. How to figure out this problem?
Task:
community.zabbix.zabbix_template:
state: present
template_xml: "{{ lookup('file', 'weather.xml') }}"
Error:
connection error occurred: REST API returned {'code': -32500, 'message': 'Application error.', 'data': 'Trigger \"Device: {ITEM.VALUE}\" depends on trigger \"Device: {ITEM.VALUE}\", which does not exist.
Seriously, when I'm open GUI, selecting template and Import
it's works perfectly! idk wtd
What version of ansible, python, Zabbix, and Zabbix collection are you running?
Hello, @pyrodie18
ansible --version
ansible [core 2.16.6]
config file = None
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/user/git/ansible_zabbix/venv/lib64/python3.12/site-packages/ansible
ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
executable location = /home/user/git/ansible_zabbix/venv/bin/ansible
python version = 3.12.2 (main, Feb 21 2024, 00:00:00) [GCC 13.2.1 20231205 (Red Hat 13.2.1-6)] (/home/user/git/ansible_zabbix/venv/bin/python3)
jinja version = 3.1.3
libyaml = True
python3 --version
Python 3.12.2
ansible collection
community.zabbix 2.3.1
old Zabbix
Zabbix 5.0.37
new Zabbix
Zabbix 5.2.3
@djdejawu the zabbix collection >=2.0 doesn't support < 6.0 Zabbix. Roll back to a version of the collection before we did the 2.0 release and you'll likely be fine.
@pyrodie18 Nope, doesn't helped.
ansible-galaxy collection list community.zabbix
# /home/user/.ansible/collections/ansible_collections
Collection Version
---------------- -------
community.zabbix 1.9.3
I've got
connection error occurred: REST API returned {'code': -32500, 'message': 'Application error.', 'data': 'Trigger \"Device: {ITEM.VALUE}\" depends on trigger \"Device: {ITEM.VALUE}\", which does not exist.