You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugin inventory "zabbix_inventory" has an issue with the extra vars when using "filter" as parameter.
Extra vars are not detected and used by the plugin.
Example with extra var:
use_extra_vars: true
plugin: zabbix.zabbix.zabbix_inventory
zabbix_api_url: "https://myzabbix.com"
validate_certs: true
query:
selectInventory: ["model"]
filter:
tags:
- tag: Team
value: "{{ team }}"
In accordance with the issue, this functionality was added to the inventory plugin in this commit. 29b774c
Please note that this improvement is currently available only on Github. In Ansible Galaxy, this improvement will become available only after the next release of our collection, which will include this and other new features/improvements.
After updating the plugin, to use "extra-vars" you will need to meet 3 conditions:
Add use_extra_vars: true to the inventory file or specify the use of extra-vars in the ansible configuration file.
Specify a variable in the inventory file in 'Jinja' format. (e.g., zabbix_api_url: 'http://{{ url }}').
Add --extra-vars or -e with the value in the command line. (e.g., --extra-vars url="your-zabbix.com").
Only if these 3 conditions are met, extra-vars will be expanded to their values.
In the inventory file you need to specify the variable in the format '{{ var_name }}', as you correctly did in the description. As short example:
---
plugin: "zabbix.zabbix.zabbix_inventory"# Set the using of extra-varsuse_extra_vars: true# Set credentialszabbix_api_url: 'http://{{ url }}'zabbix_user: Adminzabbix_password: zabbix
And command for ansible-inventory: ansible-inventory --extra-vars url="your-zabbix.com" -i zabbix_inventory.yml --list
An example of using extra-vars can be found in more detail in the README for the inventory plugin.
Hello,
The plugin inventory "zabbix_inventory" has an issue with the extra vars when using "filter" as parameter.
Extra vars are not detected and used by the plugin.
Example with extra var:
Example without extra_var:
I have tested extra vars into the query parameter and that works fine.
The text was updated successfully, but these errors were encountered: