ansible-collections / community.zabbix

Zabbix Ansible modules
http://galaxy.ansible.com/community/zabbix
Other
321 stars 280 forks source link

Zabbix-agent - API calls. Host/Group vars are not loaded to the httpapi-connection plugin #1241

Closed kivilahtio closed 2 months ago

kivilahtio commented 4 months ago
SUMMARY

When I define:

zabbix_api_server_host:
zabbix_api_server_port:
zabbix_api_login_user:
zabbix_api_use_ssl:
zabbix_api_login_pass:

In group vars or host vars they are not used in the roles/zabbix_agent/tasks/api.yml. I have to explicitly set those variables in the role defaults -file

Other vars seem to work, such as

zabbix_agent_distribution_release:
ISSUE TYPE
COMPONENT NAME

Zabbix Agent

ANSIBLE VERSION
ansible [core 2.13.13]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
  ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.10 (default, Nov 22 2023, 10:22:35) [GCC 9.4.0]
  jinja version = 3.1.4
  libyaml = True
CONFIGURATION
ANSIBLE_PIPELINING(/home/ansible/emb-toveri/Ansible/ansible.cfg) = True
COLLECTIONS_PATHS(/home/ansible/emb-toveri/Ansible/ansible.cfg) = ['/home/ansible/emb-toveri/Ansible']
DEFAULT_HOST_LIST(/home/ansible/emb-toveri/Ansible/ansible.cfg) = ['/home/ansible/ToveriConfig/inventory']
DEFAULT_REMOTE_USER(/home/ansible/emb-toveri/Ansible/ansible.cfg) = ansible
DEFAULT_STDOUT_CALLBACK(/home/ansible/emb-toveri/Ansible/ansible.cfg) = debug
DEFAULT_VAULT_PASSWORD_FILE(/home/ansible/emb-toveri/Ansible/ansible.cfg) = *************
INTERPRETER_PYTHON(/home/ansible/emb-toveri/Ansible/ansible.cfg) = /usr/bin/python3
OS / ENVIRONMENT / Zabbix Version

Ubuntu 20.04.6 LTS Zabbix agent 6.4 Python3.8.10

STEPS TO REPRODUCE

Sorry for skimping out on this.

EXPECTED RESULTS
ACTUAL RESULTS
pyrodie18 commented 4 months ago

What version of the role are you using?

kivilahtio commented 4 months ago

I cloned the source code and am using tag v2.4.0 (5bf4309704173db3eb96feddd54a07cb2e874176)

BGmot commented 4 months ago

Probably you are using wrong group/host vars files. These variables need to be defined for your Zabbix WebUI host. Try using group_vars/all.yml or define the for the host defined in zabbix_api_server_host variable.