community.general.zabbix_template_info (0.1.1) — module

Gather information about Zabbix template

Authors: sky-joker (@sky-joker)

preview | supported by community

Install collection

Install with ansible-galaxy collection install community.general:==0.1.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

This module allows you to search for Zabbix template.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get Zabbix template as JSON
  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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get Zabbix template as XML
  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

Inputs

    
format:
    choices:
    - json
    - xml
    default: json
    description:
    - Format to use when dumping template.
    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.
    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).
    required: true
    type: str

template_name:
    description:
    - Name of the template in Zabbix.
    required: true
    type: str

login_password:
    description:
    - Zabbix user password.
    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.
    type: bool

http_login_user:
    description:
    - Basic Auth login
    type: str

http_login_password:
    description:
    - Basic Auth password
    type: str

Outputs

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