ansible-collections / community.zabbix

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

Create hostgroups returns 404 Not found #1079

Closed SliuzasLukas closed 1 year ago

SliuzasLukas commented 1 year ago

Recently updated to Zabbix 6.4 and had to update my ansible scripts for it.

I am running into issue with create new zabbix hostgroups. Looked up the documentation and change the required fields to it:

`- name: "Create hostgroups" vars: ansible_network_os: community.zabbix.zabbix ansible_connection: httpapi ansible_httpapi_port: 443 ansible_httpapi_use_ssl: true ansible_httpapi_validate_certs: false http_login_user: "{{ zabbix_api_user }}" http_login_password: "{{ zabbix_api_pass }}" ansible_host: "{{ groups['zabbix_server'][0] }}" community.zabbix.zabbix_group: state: present host_groups:

As of know I am getting this error and struggling to find the solution in __rpc__\nansible.module_utils.connection.ConnectionError: Invalid JSON response: <!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL was not found on this server.</p>\n</body></html>\n\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee

I have tried running curl to see if API is responding and there was no issue. curl -k -X POST -H "Content-Type: application/json" -d '{ "jsonrpc": "2.0", "method": "user.login", "params": { "username": "NAME", "password": "PASSWORD" }, "id": 1 }' https://IP/api_jsonrpc.php

pyrodie18 commented 1 year ago

@SliuzasLukas I am assuming you have confirmed that the zabbix_api_user and zabbix_api_pass are set appropriately to the same information you used in your curl test?

SliuzasLukas commented 1 year ago

@SliuzasLukas I am assuming you have confirmed that the zabbix_api_user and zabbix_api_pass are set appropriately to the same information you used in your curl test?

Hi, yes it was correct information. I have managed to resolve the issue. Had to add this line ansible_zabbix_url_path: '' or otherwise it would be using incorrect path