When configuring the new vars with a Zabbix server that uses HTTPS, the module complains that it's HTTP request is sent to an HTTPS server:
TASK [community.zabbix.zabbix_agent : API | Create host groups] ******************************************************
FAILED - RETRYING: [config.zm1.element-networks.nl -> monitoring.zm1.element-networks.nl]: API | Create host groups (3 retries left).
FAILED - RETRYING: [config.zm1.element-networks.nl -> monitoring.zm1.element-networks.nl]: API | Create host groups (2 retries left).
FAILED - RETRYING: [config.zm1.element-networks.nl -> monitoring.zm1.element-networks.nl]: API | Create host groups (1 retries left).
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: </body></html>
fatal: [config.zm1.element-networks.nl -> monitoring.zm1.element-networks.nl]: FAILED! => changed=false
attempts: 3
module_stderr: |-
Traceback (most recent call last):
File "/home/ansible/.ansible/tmp/ansible-local-686273ghf3awe/ansible-tmp-1683674583.372596-74913-116944593910708/AnsiballZ_zabbix_group.py", line 107, in <module>
_ansiballz_main()
File "/home/ansible/.ansible/tmp/ansible-local-686273ghf3awe/ansible-tmp-1683674583.372596-74913-116944593910708/AnsiballZ_zabbix_group.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/ansible/.ansible/tmp/ansible-local-686273ghf3awe/ansible-tmp-1683674583.372596-74913-116944593910708/AnsiballZ_zabbix_group.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.community.zabbix.plugins.modules.zabbix_group', init_globals=dict(_module_fqn='ansible_collections.community.zabbix.plugins.modules.zabbix_group', _modlib_path=modlib_path),
File "/usr/lib/python3.9/runpy.py", line 210, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/tmp/ansible_community.zabbix.zabbix_group_payload_k8b7at2x/ansible_community.zabbix.zabbix_group_payload.zip/ansible_collections/community/zabbix/plugins/modules/zabbix_group.py", line 181, in <module>
File "/tmp/ansible_community.zabbix.zabbix_group_payload_k8b7at2x/ansible_community.zabbix.zabbix_group_payload.zip/ansible_collections/community/zabbix/plugins/modules/zabbix_group.py", line 153, in main
File "/tmp/ansible_community.zabbix.zabbix_group_payload_k8b7at2x/ansible_community.zabbix.zabbix_group_payload.zip/ansible_collections/community/zabbix/plugins/module_utils/base.py", line 20, in __init__
File "/tmp/ansible_community.zabbix.zabbix_group_payload_k8b7at2x/ansible_community.zabbix.zabbix_group_payload.zip/ansible_collections/community/zabbix/plugins/module_utils/api_request.py", line 53, in api_version
File "/tmp/ansible_community.zabbix.zabbix_group_payload_k8b7at2x/ansible_community.zabbix.zabbix_group_payload.zip/ansible/module_utils/connection.py", line 200, in __rpc__
ansible.module_utils.connection.ConnectionError: Invalid JSON response: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
Reason: You're speaking plain HTTP to an SSL-enabled server port.<br />
Instead use the HTTPS scheme to access this URL, please.<br />
</p>
</body></html>
module_stdout: ''
msg: |-
MODULE FAILURE
See stdout/stderr for the exact error
rc: 1
SUMMARY
When configuring the new vars with a Zabbix server that uses HTTPS, the module complains that it's HTTP request is sent to an HTTPS server:
ISSUE TYPE
COMPONENT NAME
zabbix_group
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT / Zabbix Version
6.0 on Debian
STEPS TO REPRODUCE
Run the role with the settings below
EXPECTED RESULTS
Not to break
ACTUAL RESULTS
See above, the error is quite clear
POSSIBLE FIX
Add
ansible_httpapi_use_ssl
to this task:However, this opens up a new 401 Unauthorized error when using HTTP Basic Auth... Which reminds me of #565