inventory plugin cannot login to zabbix < 6.2
s-at-ik opened this issue · comments
SUMMARY
The inventory plugin does not work with zabbix versions prior to 6.2 due to login failure.
After some digging around, this is due to the plugin using username
as parameter to login, which is not supported on older zabbix versions.
community.zabbix/plugins/inventory/zabbix_inventory.py
Lines 390 to 396 in 736b349
Interestingly, the same situation is already handled correctly by the httpapi plugin.
community.zabbix/plugins/httpapi/zabbix.py
Lines 96 to 103 in 736b349
ISSUE TYPE
- Bug Report
COMPONENT NAME
community.zabbix.zabbix_inventory
ANSIBLE VERSION
no relevant
CONFIGURATION
not relevant
OS / ENVIRONMENT / Zabbix Version
Zabbix 5.0.33
STEPS TO REPRODUCE
zabbix_inventory.yml
plugin: community.zabbix.zabbix_inventory
server_url: https://localhost
login_user: user
login_password: password
Then run:
$ ansible-inventory -i zabbix_inventory.yml --list
EXPECTED RESULTS
A list of hosts.
ACTUAL RESULTS
[WARNING]: * Failed to parse ./zabbix_inventory.yml with auto plugin: 'result'
[WARNING]: * Failed to parse ./zabbix_inventory.yml with yaml plugin: Plugin configuration YAML file, not YAML inventory
[WARNING]: * Failed to parse ./zabbix_inventory.yml with ini plugin: Invalid host pattern 'plugin:' supplied, ending in ':' is not allowed, this character is reserved
to provide a port.
[WARNING]: Unable to parse ./zabbix_inventory.yml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
{
"_meta": {
"hostvars": {}
},
"all": {
"children": [
"ungrouped"
]
}
}
Side note, the error [WARNING]: * Failed to parse ./zabbix_inventory.yml with auto plugin: 'result'
could stand to be clearer.
After searching again (sorry I missed it the first time somehow), this issue appear similar to #1016.
After a quick test, zabbix 6.0 supports both way to authenticate (username
or user
), which mean the inventory plugin actually works for all zabbix versions for which support is intended. If anything, it's the httpapi plugin which could be simplified. I will close this issue.