Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zabbix 5.4 template import fails with "Template already exists" #449

Closed
nerijus opened this issue Sep 2, 2021 · 1 comment
Closed

Zabbix 5.4 template import fails with "Template already exists" #449

nerijus opened this issue Sep 2, 2021 · 1 comment

Comments

@nerijus
Copy link

nerijus commented Sep 2, 2021

Using community.zabbix 1.4.0, zabbix 5.4.4.
Similar issue as #407 (comment) - while trying to import a template, I get:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: zabbix_api.Already_Exists: ('Error -32602: Invalid params., Template "check dev-games-backend.example.com_v1_ab-kiron-vf_version HIGH" already exists.

How do I overwrite existing template without deleting it first?
The playbook code is like this:

- name: Import {{ item.vhost }} zabbix service health-checks template
  local_action:
    module: zabbix_template
    server_url: "{{ zabbix_server_url }}"
    login_user: "{{ zabbix_server_user }}"
    login_password: "{{ zabbix_server_password }}"
    template_groups: "nginx-common"
    template_json: "{{ lookup('template', 'zabbix_proxy_service_health_check.json.j2') }}"
    state: present
  vars:
    checks: "{{ item.proxy_config.include_services | dict2items | map(attribute='value') | flatten | map(attribute='zabbix_healthcheck') | select('defined') | rejectattr('path', 'eq', 'SKIP') }}"
  when: item.proxy_config.include_services | dict2items | map(attribute='value') | flatten | map(attribute='zabbix_healthcheck') | select('defined') | rejectattr('path', 'eq', 'SKIP') |  length > 0
@nerijus
Copy link
Author

nerijus commented Sep 20, 2021

It happens if I try to import template with UUIDs, which differ from the ones in existing template. If I import template with the same UUIDs (or without any - need to test), it works.

@nerijus nerijus closed this as completed Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant