Closed mmarkgraf-tpgroup closed 2 years ago
Hi, thank you for reporting this. Can you please also provide Zabbix server version you are running on?
Sure. I'm using the dockerized zabbix-server-pgsql/alpine-5.2-latest
Maybe this is linked to a problem I found:
when you request info with zabbix_host_info the field interfaces.details returns an empty list for non-snmp interfaces - but zabbix_host expects an dictionary for this!
I have two roles adding different interfaces/templates to a host. Since we cannot add interface you always have to check the existance of the interface/host before running zabbix_host. If the second role is run for the first time we have to join the existing interface (from the first role) and the new. I get the existing agent interface with zabbix_host_info. This reply has an empty interface.details key. So, before using this with the interface in role 2 I have to delete/update that key "manually" to use it for the second run.
I am not sure if this related. I am happy to file a new bug report otherwise.
@mmarkgraf-tpgroup can you try zabbix_host.py from https://github.com/ansible-collections/community.zabbix/pull/718 ? Zabbix 5.2 is not supported but should work. We test on 4.0, 5.0 and 6.0.
@sebneus you can add interfaces, just specify
force: false
and the interface will be added to already existing ones (if it is not already there).
@BGmot zabbix_host.py from #718 is working as intended :-)
And I tried both, force: True
and force: False
Thanks for that!
Please note that force: True
with my previously installed zabbix_host.py does the trick as well. (No idea why that was changed from the default. I'll see if it falls on my feet elsewhere...)
SUMMARY
community.zabbix.zabbix_host will only run successfully once when attaching snmp-interfaces. Running the module again with the exact same config will result in an error like this one:
As you can see the module uses "hostinterface.create", when it should use "update".
ISSUE TYPE
COMPONENT NAME
community.zabbix.zabbix_host
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT / Zabbix Version
Target OS: Debian buster
STEPS TO REPRODUCE
EXPECTED RESULTS
I expected the interface to be attached to the host.
ACTUAL RESULTS
It did on the first run, but failed on subsequent runs. See above.