Closed DamienUKCEH closed 5 days ago
found my issue. we had an extra space in our mapping from ansible_facts to the facts as vars value.
user cleaned up env mapping had an extras space in for more than a year but issue only started happen, but found and resolved. ansible_distribution_major_version: "{{ ansible_facts.distribution_major_version }}"
SUMMARY
when trying to run the role to install agent on RHEL platforms ( tested only with Rocky 8 & 9) the role fails to deploy with a 'dict object' due to OS value being passed having a space ie '9 ' or '8 ' as such we get a fail.
ISSUE TYPE
ANSIBLE VERSION
CONFIGURATION
ansible-config dump --only-changed ANSIBLE_NOCOWS(/etc/ansible/ansible.cfg) = True COLOR_ERROR(/etc/ansible/ansible.cfg) = bright red COLOR_VERBOSE(/etc/ansible/ansible.cfg) = bright cyan CONFIG_FILE() = /etc/ansible/ansible.cfg DEFAULT_GATHERING(/etc/ansible/ansible.cfg) = implicit DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/home/ansible/redacted/netbox-inventory.yml'] DEFAULT_MANAGED_STR(/etc/ansible/ansible.cfg) = Ansible managed file DEFAULT_TIMEOUT(/etc/ansible/ansible.cfg) = 300 DEFAULT_VAULT_PASSWORD_FILE(/etc/ansible/ansible.cfg) = /etc/ansible/vault_key INJECT_FACTS_AS_VARS(/etc/ansible/ansible.cfg) = False PLAYBOOK_DIR(/etc/ansible/ansible.cfg) = /home/ansible/redacted TASK_TIMEOUT(/etc/ansible/ansible.cfg) = 3600
TASK [community.zabbix.zabbix_agent : Include OS-specific variables] **** task path: /home/ansible/.ansible/collections/ansible_collections/community/zabbix/roles/zabbix_agent/tasks/main.yml:3 ok: [wlsc-lin67] => { "ansible_facts": { "zabbix_agent": "zabbix-agent", "zabbix_valid_agent_versions": { "8": [ 7.0, 6.4, 6.0 ], "9": [ 7.0, 6.4, 6.0 ] } }, "ansible_included_var_files": [ "/home/ansible/.ansible/collections/ansible_collections/community/zabbix/roles/zabbix_agent/vars/RedHat.yml" ], "changed": false }
TASK [community.zabbix.zabbix_agent : Determine Latest Supported Zabbix Version] **** task path: /home/ansible/.ansible/collections/ansible_collections/community/zabbix/roles/zabbix_agent/tasks/main.yml:8 skipping: [wlsc-lin67] => { "changed": false, "false_condition": "zabbix_agent_version is not defined or zabbix_agent_version is none", "skip_reason": "Conditional result was False" }
TASK [community.zabbix.zabbix_agent : Check that version is supported] ** task path: /home/ansible/.ansible/collections/ansible_collections/community/zabbix/roles/zabbix_agent/tasks/main.yml:15 fatal: [wlsc-lin67]: FAILED! => { "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute '8 '\n\nThe error appears to be in '/home/ansible/.ansible/collections/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: Check that version is supported\n ^ here\n" }
PLAY RECAP ** wlsc-lin67 : ok=2 changed=0 unreachable=0 failed=1 skipped=1 rescued=0 ignored=0
TASK [community.zabbix.zabbix_agent : Include OS-specific variables] **** task path: /home/ansible/.ansible/collections/ansible_collections/community/zabbix/roles/zabbix_agent/tasks/main.yml:3 ok: [wlsc-dd-test] => { "ansible_facts": { "zabbix_agent": "zabbix-agent", "zabbix_valid_agent_versions": { "8": [ 7.0, 6.4, 6.0 ], "9": [ 7.0, 6.4, 6.0 ] } }, "ansible_included_var_files": [ "/home/ansible/.ansible/collections/ansible_collections/community/zabbix/roles/zabbix_agent/vars/RedHat.yml" ], "changed": false }
TASK [community.zabbix.zabbix_agent : Determine Latest Supported Zabbix Version] **** task path: /home/ansible/.ansible/collections/ansible_collections/community/zabbix/roles/zabbix_agent/tasks/main.yml:8 skipping: [wlsc-dd-test] => { "changed": false, "false_condition": "zabbix_agent_version is not defined or zabbix_agent_version is none", "skip_reason": "Conditional result was False" }
TASK [community.zabbix.zabbix_agent : Check that version is supported] ** task path: /home/ansible/.ansible/collections/ansible_collections/community/zabbix/roles/zabbix_agent/tasks/main.yml:15 fatal: [wlsc-dd-test]: FAILED! => { "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute '9 '\n\nThe error appears to be in '/home/ansible/.ansible/collections/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: Check that version is supported\n ^ here\n" }
PLAY RECAP ** wlsc-dd-test : ok=2 changed=0 unreachable=0 failed=1 skipped=1 rescued=0 ignored=0