diff --git a/changelogs/fragments/zabbix_agent_listenip.yml b/changelogs/fragments/zabbix_agent_listenip.yml new file mode 100644 index 000000000..b8d9d348f --- /dev/null +++ b/changelogs/fragments/zabbix_agent_listenip.yml @@ -0,0 +1,2 @@ +minor_changes: + - zabbix_agent role - accept several IPs in `zabbix_agent_listenip` variable. diff --git a/roles/zabbix_agent/tasks/Linux.yml b/roles/zabbix_agent/tasks/Linux.yml index 99af1374b..d7bf1eff8 100644 --- a/roles/zabbix_agent/tasks/Linux.yml +++ b/roles/zabbix_agent/tasks/Linux.yml @@ -75,11 +75,13 @@ - name: "Fail invalid specified agent_listenip" ansible.builtin.fail: - msg: "The agent_listenip does not exist" + msg: "The {{ item }} (agent_listenip) does not exist" when: - - zabbix_agent_listenip != '0.0.0.0' - - zabbix_agent_listenip != '127.0.0.1' - - (zabbix_agent_listenip not in ansible_all_ipv4_addresses) + - item != '0.0.0.0' + - item != '127.0.0.1' + - item not in ansible_all_ipv4_addresses + with_items: + "{{ zabbix_agent_listenip | split(',') }}" tags: - config