Closed richlv closed 10 months ago
How do you actually pass this to zabbix_host
module?
- name: Add the ad-hoc hosts
zabbix_host:
"{{item}}"
loop: "{{hosts + generic_hosts}}"
become: false
vars:
ansible_connection: httpapi
ansible_user: username
Other connection parameters are specified in variables. This works for all other hosts, just this one complains about this one template.
Templates should be defined this way
link_templates:
- MAS_Services
- HS Template OS Linux
Ouch. Well, that explains why it worked for other hosts, as those did not have this extra "name: " part... Thank you so much for spotting this, I had stared at it for way too long...
Closing as user error.
Looks like it tried to use hash as a template name? Perhaps longer term some validation (template names to be strings only) is feasible to prevent silly users from harming themselves :)
SUMMARY
Host creation fails with "Template not found: {'name': 'MAS_Services'}" despite the mentioned template existing on the target server.
ISSUE TYPE
COMPONENT NAME
zabbix_host
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT / Zabbix Version
Zabbix 6.4.10.
STEPS TO REPRODUCE
A host definition as below.
EXPECTED RESULTS
Host is created.
ACTUAL RESULTS
Adding -vvvv does not seem to provide any additional detail, the template linkage section looks like this:
I might be missing something obvious, but having verified everything several times cannot see anything:
As the error message is produced right away, it seems like the module is throwing this error instead of the Zabbix API.