I am new to Ansible and i am getting the following erro while running " rhel-system-roles.selinux". Could you please help to resolve this error.
Environment:
RHEL- 9
Ansible core - 2.12.2
python version = 3.9.10
TASK [rhel-system-roles.selinux : Install SELinux python2 tools] *********************************************************
fatal: [ss1]: FAILED! => {“msg”: “The conditional check ‘ansible_python_version is version(‘3’, ‘<’)’ failed. The error was: error while evaluating conditional (ansible_python_version is version(‘3’, ‘<’)): ‘ansible_python_version’ is undefined\n\nThe error appears to be in ‘/usr/share/ansible/roles/rhel-system-roles.selinux/tasks/main.yml’: line 2, 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: Install SELinux python2 tools\n ^ here\n”}
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’
PLAY [localhost] *****************************************************************************************************************************************************************************************************************
TASK [Do we have ansible_python_version] *****************************************************************************************************************************************************************************************
ok: [localhost] => {
“ansible_python_version”: “VARIABLE IS NOT DEFINED!”
}
TASK [gather some facts] *********************************************************************************************************************************************************************************************************
ok: [localhost]
TASK [Do we have ansible_python_version] *****************************************************************************************************************************************************************************************
ok: [localhost] => {
“ansible_python_version”: “3.6.5”
}
Since you are using rhel-system-roles, this means you are a RHEL and/or an Ansible customer.
If you installed the rpm, use rpm -q rhel-system-roles
If you installed from AutomatIon Hub, use ansible-galaxy collection list or something like that.