community.zabbix.zabbix_host_facts (0.2.0) — module

Gather information about Zabbix host

Authors: Michael Miko (@RedWhiteMiko)

Install collection

Install with ansible-galaxy collection install community.zabbix:==0.2.0


Add to requirements.yml

  collections:
    - name: community.zabbix
      version: 0.2.0

Description

This module allows you to search for Zabbix host entries.

This module was called C(zabbix_host_facts) before Ansible 2.9. The usage did not change.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get host info
  local_action:
    module: zabbix_host_info
    server_url: http://monitor.example.com
    login_user: username
    login_password: password
    host_name: ExampleHost
    host_ip: 127.0.0.1
    timeout: 10
    exact_match: no
    remove_duplicate: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Reduce host inventory information to provided keys
  local_action:
    module: zabbix_host_info
    server_url: http://monitor.example.com
    login_user: username
    login_password: password
    host_name: ExampleHost
    host_inventory:
      - os
      - tag
    host_ip: 127.0.0.1
    timeout: 10
    exact_match: no
    remove_duplicate: yes

Inputs

    
host_ip:
    description:
    - Host interface IP of the host in Zabbix.
    - Required when I(host_name) is not used.
    elements: str
    required: false
    type: list

timeout:
    default: 10
    description:
    - The timeout of API request (seconds).
    type: int

host_name:
    description:
    - Name of the host in Zabbix.
    - host_name is the unique identifier used and cannot be updated using this module.
    - Required when I(host_ip) is not used.
    required: false
    type: str

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

exact_match:
    default: false
    description:
    - Find the exact match
    type: bool

host_inventory:
    description:
    - List of host inventory keys to display in result.
    - Whole host inventory is retrieved if keys are not specified.
    elements: str
    required: false
    type: list

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

remove_duplicate:
    default: true
    description:
    - Remove duplicate host from host result
    type: bool

http_login_password:
    description:
    - Basic Auth password
    type: str

Outputs

hosts:
  description: List of Zabbix hosts. See https://www.zabbix.com/documentation/4.0/manual/api/reference/host/get
    for list of host values.
  returned: success
  sample:
  - '...': null
    available: '1'
    description: ''
    disable_until: '0'
    error: ''
    flags: '0'
    groups:
    - '1'
    host: Host A
  type: dict