-
Incident report
-
Resolution: Duplicate
-
Trivial
-
None
-
4.0.1
-
Zabbix server:
RedHat Enterprise Linux 6.9 (kernel 2.6.32-696.13.2.el6.x86_64)
Ansible host:
RedHat Enterprise Linux 7.3 (kernel 3.10.0-693.11.1.el7.x86_64)
[jan@ansible-m01 ansible-sys]$ ansible --version
ansible 2.7.2
config file = /opt/ansible-sys/ansible.cfg
configured module search path = [u'/opt/ansible-sys/git/library']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, May 3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)]Zabbix server: RedHat Enterprise Linux 6.9 (kernel 2.6.32-696.13.2.el6.x86_64) Ansible host: RedHat Enterprise Linux 7.3 (kernel 3.10.0-693.11.1.el7.x86_64) [ jan@ansible-m01 ansible-sys]$ ansible --version ansible 2.7.2 config file = /opt/ansible-sys/ansible.cfg configured module search path = [u'/opt/ansible-sys/git/library'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /usr/bin/ansible python version = 2.7.5 (default, May 3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)]
Steps to reproduce:
- Exported zabbix template for Linux OS'es (cfr. attachments)
- Import it via Ansible module zabbix_template
Result:
The Ansible playbook
- hosts: test01 gather_facts: no become: no tasks: - block: - name: Configure Linux OS template in Zabbix local_action: module: zabbix_template validate_certs: no server_url: "http://zabbix40/zabbix" login_user: "ansible" login_password: "mypasswordhere" template_name: "{{ item | basename | regex_replace('.json.j2','') }}" template_json: "{{ lookup('template', item) }}" timeout: 60 state: present loop: - "Template_OS_Linux.json.j2" run_once: yes
results in
The full traceback is: Traceback (most recent call last): File "/tmp/ansible_zabbix_template_payload_RkCoRf/__main__.py", line 427, in import_template 'rules': update_rules File "/usr/lib/python2.7/site-packages/zabbix_api.py", line 329, in method return self.universal("%s.%s" % (self.data["prefix"], name), opts[0]) File "/usr/lib/python2.7/site-packages/zabbix_api.py", line 79, in wrapper return self.do_request(self.json_obj(method, opts))['result'] File "/usr/lib/python2.7/site-packages/zabbix_api.py", line 336, in do_request return self.parent.do_request(req) File "/usr/lib/python2.7/site-packages/zabbix_api.py", line 255, in do_request raise APITimeout("HTTP read timeout",) APITimeout: HTTP read timeout failed: [ansible-t01 -> localhost] (item=Template_OS_Linux.json.j2) => { "changed": false, "details": "HTTP read timeout", "invocation": { "module_args": { "clear_templates": null, "http_login_password": null, "http_login_user": null, "link_templates": null, "login_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "login_user": "ansible", "macros": null, "server_url": "http://zabbix04/zabbix", "state": "present" ], "template_json": "{\"zabbix_export\": {\"templates\": [{\"templates\": [{\"name\": \"Template App Zabbix Agent\"}], \"description\": \"\", ...<<removed template output because of the text field limitation of 32767 characters in the issue creation form, cfr. attached template>> ..., \"version\": \"3.4\", \"groups\": [{\"name\": \"Templates\"}, {\"name\": \"Templates (Ansible-managed)\"}], \"date\": \"2018-09-13T08:58:49Z\"}}", "template_name": "Template_OS_Linux", "timeout": 60, "validate_certs": false } }, "item": "Template_OS_Linux.json.j2", "msg": "Unable to import JSON template" }
I don't find anything that seems related in the zabbix server logs.
Expected:
The Ansible task results in Changed or OK meaning the template has been sucesfully imported or it already exists on the server:
2018-11-11 13:21:02,374 p=46092 u=jan | TASK [zabbixagent : Configure Linux OS template in Zabbix] ***************************************************************************************************************************************************************************** 2018-11-11 13:21:05,630 p=46092 u=jan | ok: [ansible-t01 -> localhost] => (item=Template_OS_Linux.json.j2)
- duplicates
-
ZBX-7700 Adding templates to hosts is incredibly slow in large environments
- Open