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

create host doesn't appaer to run #302

Closed ghost closed 4 years ago

ghost commented 4 years ago

Describe the bug I'm trying to create hosts via the api after the agent is setup, but it never appears to run the api commands.

Installation method/version

-->

Ansible Version

ansible 2.9.4
  config file = /home/gregf/ownCloud/dev/active/hugops-infrastructure/ansible.cfg
  configured module search path = ['/home/gregf/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.8/site-packages/ansible
  executable location = /bin/ansible
  python version = 3.8.1 (default, Jan 22 2020, 06:38:00) [GCC 9.2.0]

Targetted hosts

Expected behavior For the host to appear in zabbix after the playbook is run.

I have the following playbook.

  vars:
    zabbix_version: 4.4
    zabbix_agent_server: 10.0.0.105
    zabbix_agent_serveractive: 10.0.0.105
    zabbix_install_pip_packages: True
    zabbix_agent_firewall_enable: True
    zabbix_agent_firewall_source: 10.0.0.105
    zabbix_url: 'https://zabbix.example.com'
    zabbix_api_use: True
    zabbix_api_user: 'ansible'
    zabbix_api_pass: 'my_pass'
    zabbix_create_host: True
    zabbix_agent_tlsconnect: psk
    zabbix_agent_tlsaccept: psk
    zabbix_agent_tlspskidentity: default
    zabbix_agent_tlspskfile: '/etc/zabbix/zabbix_agentd.psk'
    zabbix_agent_tlspsk_secret: 'my_secret'
    zabbix_host_groups:
      - Linux Servers
    zabbix_link_templates:
      - Template OS Linux
  roles:
    - { role: dj-wasabi.zabbix-agent }

It converges fine, no errors. I first noticed none of the hosts were being added to zabbix. I ran it and there's no logs of the api commands even being run. I tried both True and true, wasn't sure the proper way in python honestly.

ghost commented 4 years ago

It's zabbix_api_create_hosts not zabbix_create_host. I think some parts of the readme in the examples may need updating.