Hello guys,
i have a problem with using the community.zabbix.zabbix_agent role
in my tasks. I am currently using Ansible only for my Linux servers which are all running Ubuntu 24.04 LTS.
My code is part of a tasks file inside a role that i created myself. Here is my code:
- name: Install and configure Zabbix Agent 2
include_role:
name: community.zabbix.zabbix_agent
vars:
zabbix_agent_variant: 2
zabbix_agent_server: "{{ zabbix_agent_server }}"
zabbix_agent_serveractive: "{{ zabbix_agent_server_active }}"
zabbix_agent_tlspskidentity: "#####"
zabbix_agent_tlspskfile: "{{ zabbix_agent_psk_path }}"
zabbix_agent_tlsconnect: "psk"
zabbix_agent_tlsaccept: "psk"
zabbix_agent_service_user: "user"
zabbix_agent_service_group: "user"
When i execute this code i get the following output:
TASK [community.zabbix.zabbix_agent : Set More Variables] ***************************************************************************************************************************************************
fatal: [server]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute '24'. 'dict object' has no attribute '24'\n\nThe error appears to be in '/usr/lib/python3/dist-packages/ansible_collections/community/zabbix/roles/zabbix_agent/tasks/main.yml': line 15, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set More Variables\n ^ here\n"}
I had a look at this file (‘/usr/lib/python3/dist-packages/ansible_collections/community/zabbix/roles/zabbix_agent/tasks/main.yml’) and have seen this part:
- name: Set More Variables
ansible.builtin.set_fact:
zabbix_valid_version: "{{ zabbix_agent_version|float in zabbix_valid_agent_versions[ansible_distribution_major_version] }}"
tags:
- always
- name: Stopping Install of Invalid Version
ansible.builtin.fail:
msg: Zabbix version {{ zabbix_agent_version }} is not supported on {{ ansible_distribution }} {{ ansible_distribution_major_version }}
when: not zabbix_valid_version
tags:
- always
Could my operating system version be the issue here? The number 24 that is displayed in the error message only makes sense to me because of an unsupported OS version. But according to the documentation on Ansible Galaxy all Ubuntu versions should be supported.
Can you help me?