Error updating Zabbix Host (zabbix_host)

298 views
Skip to first unread message

Reece Webb

unread,
Jun 6, 2016, 5:32:20 PM6/6/16
to Ansible Project
Ansible 2.1, Zabbix 3.0.3, latest zabbix-api module.

I'm trying to write a playbook to update a Zabbix hosts agent interface IP. The host already exists, it has an agent interface (with an incorrect IP). It looks like my playbook is failing because a host group isn't specified, but I don't want to change any existing host group info (or anything aside from the interface IP)...

Error:
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: ansible
<localhost> EXEC /bin/sh -c 'LANG=C LC_ALL=C LC_MESSAGES=C /usr/bin/python && sleep 0'
fatal: [superrad-mz -> localhost]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"force": true, "host_groups": null, "host_name": "superrad-mz", "http_login_password": null, "http_login_user": null, "interfaces": [{"ip": "64.54.31.174", "main": 1, "port": 10050, "type": 1, "useip": 1}], "inventory_mode": null, "link_templates": null, "login_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "login_user": "zabmin", "proxy": null, "server_url": "https://raddix.radiology.ucsf.edu", "state": "present", "status": "enabled", "timeout": 10}, "module_name": "zabbix_host"}, "msg": "Specify at least one group for updating host 'superrad-mz'."}
...ignoring


Playbook:
---
# file: common.yml

- name: Update Host Interface IP
  ignore_errors: True
  local_action:
    module: zabbix_host
    login_user: zabmin
    login_password: <password>
    host_name: "{{ ansible_hostname }}"
    interfaces:
      - type: 1
        main: 1
        ip: "{{ ansible_default_ipv4.address }}"
        port: 10050
        useip: 1
  tags:
    - interface


Am I doing something wrong, or any ideas?

Thanks,
Reece

Dorian Basuyau

unread,
Dec 1, 2016, 11:16:06 AM12/1/16
to Ansible Project
I encountered similar issue.

Even when only enabling/disabling we need to specify a valid hostgroup for the Zabbix instance : https://github.com/ansible/ansible-modules-extras/blob/devel/monitoring/zabbix_host.py#L230

Thanks.

D
Reply all
Reply to author
Forward
0 new messages