community / community.zabbix / 1.8.0 / module / zabbix_template_info Gather information about Zabbix template Authors: sky-joker (@sky-joker)community.zabbix.zabbix_template_info (1.8.0) — module
Install with ansible-galaxy collection install community.zabbix:==1.8.0
collections: - name: community.zabbix version: 1.8.0
This module allows you to search for Zabbix template.
- 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
- name: Get Zabbix template as YAML community.zabbix.zabbix_template_info: server_url: "http://zabbix.example.com/zabbix/" login_user: admin login_password: secret template_name: Template format: yaml omit_date: no register: template_yaml
- name: Determine if Zabbix template exists community.zabbix.zabbix_template_info: server_url: "http://zabbix.example.com/zabbix/" login_user: admin login_password: secret template_name: Template format: none register: template
format: choices: - json - xml - yaml - none default: json description: - Format to use when dumping template. - C(yaml) works only with Zabbix >= 5.2. type: str timeout: default: 10 description: - The timeout of API request (seconds). type: int omit_date: default: false description: - Removes the date field for the dumped template required: false type: bool login_user: description: - Zabbix user name. - If not set the environment variable C(ZABBIX_USERNAME) will be used. required: true type: str server_url: aliases: - url description: - URL of Zabbix server, with protocol (http or https). C(url) is an alias for C(server_url). - If not set the environment variable C(ZABBIX_SERVER) will be used. required: true type: str template_name: description: - Name of the template in Zabbix. required: true type: str login_password: description: - Zabbix user password. - If not set the environment variable C(ZABBIX_PASSWORD) will be used. required: true type: str validate_certs: default: true description: - If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. - If not set the environment variable C(ZABBIX_VALIDATE_CERTS) will be used. type: bool http_login_user: description: - Basic Auth login type: str http_login_password: description: - Basic Auth password type: str
template_id: description: The ID of the template returned: always type: str template_json: description: The JSON of the template returned: when format is json and omit_date is true 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' type: str template_xml: description: The XML of the template returned: when format is xml and omit_date is false sample: "<zabbix_export>\n <version>4.0</version>\n <date>2019-10-27T14:49:57Z</date>\n\ \ <groups>\n <group>\n <name>Templates</name>\n </group>\n\ \ </groups>\n <templates>\n <template>\n <template>Test\ \ Template</template>\n <name>Template for Testing</name>\n \ \ <description>Testing template import</description>\n <groups>\n\ \ <group>\n <name>Templates</name>\n \ \ </group>\n </groups>\n <applications>\n \ \ <application>\n <name>Test Application</name>\n\ \ </application>\n </applications>\n <items\ \ />\n <discovery_rules />\n <httptests />\n \ \ <macros />\n <templates />\n <screens />\n </template>\n\ \ </templates>\n</zabbix_export>" type: str template_yaml: description: The YAML of the template returned: when format is yaml and omit_date is false sample: "zabbix_export:\n version: '6.0'\n date: '2022-07-09T13:25:18Z'\n groups:\n\ \ -\n uuid: 7df96b18c230490a9a0a9e2307226338\n name: Templates\n\ \ templates:\n -\n uuid: 88a9ad240f924f669eb7d4eed736320c\n template:\ \ 'Test Template'\n name: 'Template for Testing'\n description: 'Testing\ \ template import'\n groups:\n -\n name: Templates" type: str