W3cubDocs

/Ansible 2.11

community.zabbix.zabbix_template_info – Gather information about Zabbix template

Note

This plugin is part of the community.zabbix collection (version 1.2.0).

To install it use: ansible-galaxy collection install community.zabbix.

To use it in a playbook, specify: community.zabbix.zabbix_template_info.

Synopsis

  • This module allows you to search for Zabbix template.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 2.6
  • zabbix-api >= 0.5.4

Parameters

Parameter Choices/Defaults Comments
format
string
    Choices:
  • json
  • xml
Format to use when dumping template.
http_login_password
string
Basic Auth password
http_login_user
string
Basic Auth login
login_password
string / required
Zabbix user password.
login_user
string / required
Zabbix user name.
omit_date
boolean
    Choices:
  • no
  • yes
Removes the date field for the dumped template
server_url
string / required
URL of Zabbix server, with protocol (http or https). url is an alias for server_url.

aliases: url
template_name
string / required
Name of the template in Zabbix.
timeout
integer
Default:
10
The timeout of API request (seconds).
validate_certs
boolean
    Choices:
  • no
  • yes
If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.

Notes

Note

  • If you use login_password=zabbix, the word “zabbix” is replaced by “****” in all module output, because login_password uses no_log. See this FAQ for more information.

Examples

- name: Get Zabbix template as JSON
  community.zabbix.zabbix_template_info:
    server_url: "http://zabbix.example.com/zabbix/"
    login_user: admin
    login_password: secret
    template_name: Template
    format: json
    omit_date: yes
  register: template_json

- name: Get Zabbix template as XML
  community.zabbix.zabbix_template_info:
    server_url: "http://zabbix.example.com/zabbix/"
    login_user: admin
    login_password: secret
    template_name: Template
    format: xml
    omit_date: no
  register: template_json

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
template_json
string
when format is json and omit_date is true
The JSON of the template

Sample:
{'zabbix_export': {'groups': [{'name': 'Templates'}], 'templates': [{'applications': [{'name': 'Test Application'}], 'description': 'Testing template import', 'discovery_rules': [], 'groups': [{'name': 'Templates'}], 'httptests': [], 'items': [], 'macros': [], 'name': 'Template for Testing', 'screens': [], 'template': 'Test Template', 'templates': []}], 'version': '4.0'}}
template_xml
string
when format is xml and omit_date is false
The XML of the template

Sample:
<zabbix_export> <version>4.0</version> <date>2019-10-27T14:49:57Z</date> <groups> <group> <name>Templates</name> </group> </groups> <templates> <template> <template>Test Template</template> <name>Template for Testing</name> <description>Testing template import</description> <groups> <group> <name>Templates</name> </group> </groups> <applications> <application> <name>Test Application</name> </application> </applications> <items /> <discovery_rules /> <httptests /> <macros /> <templates /> <screens /> </template> </templates> </zabbix_export>


Authors

  • sky-joker (@sky-joker)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/community/zabbix/zabbix_template_info_module.html