Documentation

zabbix_host - Zabbix host creates/updates/deletes

New in version 2.0.

Synopsis

  • This module allows you to create, modify and delete Zabbix host entries and associated group and template data.

Options

parameter required default choices comments
force
(added in 2.0)
no yes
  • yes
  • no
Overwrite the host configuration, even if already present
host_groups
no
List of host groups the host is part of.
host_name
yes
Name of the host in Zabbix.
host_name is the unique identifier used and cannot be updated using this module.
http_login_password
(added in 2.1)
no None
Basic Auth password
http_login_user
(added in 2.1)
no None
Basic Auth login
interfaces
no
List of interfaces to be created for the host (see example below).
Available values are: dns, ip, main, port, type and useip.
Please review the interface documentation for more information on the supported properties
https://www.zabbix.com/documentation/2.0/manual/appendix/api/hostinterface/definitions#host_interface
inventory_mode
(added in 2.1)
no None
  • automatic
  • manual
  • disabled
Configure the inventory mode.
link_templates
no None
List of templates linked to the host.
login_password
yes
Zabbix user password.
login_user
yes
Zabbix user name, used to authenticate against the server.
proxy
no None
The name of the Zabbix Proxy to be used
server_url
yes
Url of Zabbix server, with protocol (http or https).

aliases: url
state
no present
  • present
  • absent
State of the host.
On present, it will create if host does not exist or update the host if the associated data is different.
On absent will remove a host if it exists.
status
no enabled
  • enabled
  • disabled
Monitoring status of the host.
timeout
no 10
The timeout of API request (seconds).
visible_name
(added in 2.3)
no
Visible name of the host in Zabbix.

Examples

- name: Create a new host or update an existing host's info
  local_action:
    module: zabbix_host
    server_url: http://monitor.example.com
    login_user: username
    login_password: password
    host_name: ExampleHost
    visible_name: ExampleName
    host_groups:
      - Example group1
      - Example group2
    link_templates:
      - Example template1
      - Example template2
    status: enabled
    state: present
    inventory_mode: automatic
    interfaces:
      - type: 1
        main: 1
        useip: 1
        ip: 10.xx.xx.xx
        dns: ""
        port: 10050
      - type: 4
        main: 1
        useip: 1
        ip: 10.xx.xx.xx
        dns: ""
        port: 12345
    proxy: a.zabbix.proxy

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Support

This module is community maintained without core committer oversight.

For more information on what this means please read Module Support

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.