dj-wasabi / ansible-zabbix-agent

Installing and maintaining zabbix-agent for RedHat/Debian/Ubuntu/Windows/Suse.
https://galaxy.ansible.com/dj-wasabi/zabbix-agent
MIT License
327 stars 249 forks source link

zabbix api error #53

Closed gmoshiko closed 7 years ago

gmoshiko commented 7 years ago

my config:

and the error: TASK [dj-wasabi.zabbix-agent : Create hostgroups] ** skipping: [jiraam]

TASK [dj-wasabi.zabbix-agent : Create a new host or update an existing host's info] *** fatal: [jiraam]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: [{u'ip': u'{{ agent_ip }}', u'useip': u'{{ zabbix_useuip }}', u'dns': u'{{ ansible_fqdn }}', u'main': 1, u'type': 1, u'port': u'{{ agent_listenport }}'}]: 'agent_ip' is undefined\n\nThe error appears to have been in '/etc/ansible/roles/dj-wasabi.zabbix-agent/tasks/main.yml': line 114, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: \"Create a new host or update an existing host's info\"\n ^ here\n"} to retry, use: --limit @/etc/ansible/playbooks/zabbix.retry

would like for help, Thanks !

dj-wasabi commented 7 years ago

Hi @gmoshiko

Can you set the variable agent_ip ? It seems that {{ hostvars[inventory_hostname]['ansible_default_ipv4'].address }} isn't resolved to a ip address.

aviramartac commented 7 years ago

I solved it on my setup like this: agent_ip: "{{ hostvars[inventory_hostname].ansible_host }}

Maybe it's just a "." missing there?