ansible-collections / community.zabbix

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

Add ability to load multiple Zabbix module as set in zabbix_agentd.conf #417

Closed isuftin closed 3 years ago

isuftin commented 3 years ago
SUMMARY

The LoadModule parameter in zabbix_agentd.conf should allow multiple modules to be loaded. Curently, the config file only allows a single module to be defined.

https://github.com/ansible-collections/community.zabbix/blob/1.4.0/roles/zabbix_agent/templates/zabbix_agentd.conf.j2#L265

The variable zabbix_agent_loadmodule should be changed to a list or if still a string, template should split a comma separated string to a list and write out LoadModule={{ zabbix_agent_loadmodule }} in a loop

ISSUE TYPE
COMPONENT NAME

Zabbix Agent module

ADDITIONAL INFORMATION

This feature would conform the abilities of the Zabbix Agent module to be in-line with the intended configuration of the Zabbix agent.

dj-wasabi commented 3 years ago

Hi @isuftin

This is already the case. You can use it as a string, but also as a list. See the template:

{% if zabbix_agent_loadmodule is defined and zabbix_agent_loadmodule %}
{% if zabbix_agent_loadmodule is string %}
LoadModule={{ zabbix_agent_loadmodule }}
{% else %}
{% for module in zabbix_agent_loadmodule %}
LoadModule={{ module }}
{% endfor %}
{% endif %}
{% endif %}

With using it like the following would work as well:

zabbix_agent_loadmodule:
  - module1
  - module2
  - module3

As this is already the case, I will close this issue.