ansible-collections / community.zabbix

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

Host group not found: QA even though the group does exist #1406

Open dshleg opened 2 hours ago

dshleg commented 2 hours ago
SUMMARY

Host group not found when trying to create new host via ansible

ISSUE TYPE
COMPONENT NAME

community.zabbix version 3.1.2

ANSIBLE VERSION
tested 2.14 and 2.17
CONFIGURATION
OS / ENVIRONMENT / Zabbix Version

7.0.3

STEPS TO REPRODUCE

cat inventory/infra/group_vars/all/10-zabbix-agent-common

zabbix_agent_package_remove: True
zabbix_agent_apt_priority: 1001
zabbix_agent_dont_detect_ip: True
zabbix_agent2: True
zabbix_agent_version: 7.0
zabbix_agent_server: proxy-zbx
zabbix_agent_serveractive: proxy-zbx

zabbix_agent_userparameters_templates_src: "{{ inventory_dir }}/roles_data/templates/zabbix"
zabbix_agent_userparameters_scripts_src: "{{ inventory_dir }}/roles_data/files/scripts"

#Configure host monitoring
zabbix_useuip: 1
ansible_zabbix_url_path: '' #Fix for api
#zabbix_server', 'proxy', and 'proxy_group'
zabbix_agent_monitored_by: proxy_group
zabbix_agent_proxy_group: HOSTING-PROXY
zabbix_agent_proxy: ""
##zabbix_agent_proxy: proxy-zbx

zabbix_api_use_ssl: true
zabbix_api_server_host: zbbx-int.domain.info
zabbix_api_server_port: 443
zabbix_api_login_user: "{{ zbx_api_login_user }}"
zabbix_api_login_pass: "{{ zbx_api_login_pass }}"
zabbix_api_create_hostgroup: false
zabbix_api_create_hosts: true
zabbix_agent_host_state: present

cat inventory/infra/group_vars/linux_hypervisors/10-zabbix-agent-hypervisors

zabbix_agent_userparameters:
  - name: ZFS

#Configure host monitoring
zabbix_useuip: 1
zabbix_agent_proxy: proxy-zbx
zabbix_agent_host_state: present

#Interface types: 1 - agent, 2 - snmp, 3 - ipmi, 4 jmx
zabbix_agent_interfaces:
  - type: 1
    main: 1
    useip: "{{ zabbix_useuip }}"
    ip: "{{ ansible_host }}"
    dns: "{{ ansible_fqdn }}"
    port: "{{ zabbix_agent_listenport }}"
  - type: 3
    main: 1
    useip: "{{ zabbix_useuip }}"
    ip: "{{ ipmi_address }}"
    port: "{{ ipmi_port }}"
    dns: "{{ host_fqdn }}"

#IPMI authentication algorithm. Possible values are -1 (default), 0 (none), 1 (MD2), 2 (MD5), 4 (straight), 5 (OEM), 6 (RMCP+), with -1 being the API default.
zabbix_agent_ipmi_authtype: 6
zabbix_agent_ipmi_username: "{{ zbx_agent_ipmi_user}}"
zabbix_agent_ipmi_password: "{{ zbx_agent_ipmi_pwd }}"
#IPMI privilege level. Possible values are 1 (callback), 2 (user), 3 (operator), 4 (admin), 5 (OEM), with 2 being the API default.
zabbix_agent_ipmi_privilege: 3
zabbix_host_groups:
  - DEP/Hypervisors/Linux
  - DEP/Hardware/Servers
  - CP/Datacenter/B1

zabbix_agent_link_templates:
  - Chassis by IPMI
  - SMART by Zabbix agent 2
  - Template OS Linux
  - Template KVM-Proxmox
  - ZFS on Linux
EXPECTED RESULTS
ACTUAL RESULTS
MSG:

Hostgroup not found: CP/Datacenter/B1
dshleg commented 2 hours ago

if i login via api user to web interface and try to create host with same params manually - it works without any errors