Task failed during zabbix host group creation

Zabbix server version 7.2.3
community.zabbix version 3.2.0

ansible tasks :

    - name: Set api configuration facts
      ansible.builtin.set_fact:
        ansible_network_os: community.zabbix.zabbix
        ansible_connection: httpapi
        ansible_httpapi_port: 80
        ansible_zabbix_url_path: ''
        ansible_host: "{{ zabbix_api_host }}"
        ansible_user: "{{ zabbix_api_user }}"

    - name: Create host groups
      community.zabbix.zabbix_group:
        host_group: "{{ item}}"
        state: present
      loop: "{{ host_group_names }}"

Error:
msg: "connection error occurred: REST API returned {'code': -32600, 'message': 'Invalid request.', 'data': 'Invalid parameter \"/\": unexpected parameter \"auth\".'} when sending {\"jsonrpc\": \"2.0\", \"method\": \"hostgroup.get\", \"id\": \"84d64475-e439-47fa-8266-7a071c64033e\", \"params\": {\"output\": \"extend\", \"filter\": {\"name\": [\"group_name\"]}}, \"auth\": \"auth_token\"}"

host_group is not a parameter. community.zabbix.zabbix_group module – Create/delete Zabbix host groups — Ansible Community Documentation
It’s host_groups (plural). And there is no need for a loop. Just put an entire list in the parameter.

    - name: Create host groups
      community.zabbix.zabbix_group:
        state: present
        host_groups: "{{ host_group_names }}"

nice try, but this approach returns the same error: 'data': 'Invalid parameter \"/\": unexpected parameter \"auth\" since host_groups parameter has alias of host_group.

Fixed, solution is to upgrade community.zabbix collection to newer version, in my case its 4.0

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.