Issues running older version of ansible and core with python version

hi

I am working on a project that requires a much older version of ansible and ansible core (ansible 4.8.0 and core 2.11.12)

I installed this in a virtual environment initially with a more recent version of ansible core 2.16.7 and the python interpreter is 3.10.12. Ansible was able to run the initial simple playbook. So the yml files are ok and the playbook can execute

However I need to run this on an older version of ansible 4.8.0 (core 2.11.12) because the project involves working with a lot of older legacy applications and older application versions and I want to minimize dependency issues. (The prototyping was done with 4.8.0 with these apps and it came up fine)

However when I downgrade ansible to 4.8.0 I see the following error message (in red) when running the playbook. Note the ansible downgrades fine. The python version is still the same 3.10.12.
My question is, is this the python interpreter incompatibility with the older 4.8.0 version?
The python is at 3.10.12. If so, how can I find out which version of python would be compatible with this older version of ansible?

Would manually adding the ansible_python_interpreter in ansible.cfg be a solution to this issue (once I find out the python version)?

I am now running pyenv virtualenv but the ansible downgrade is not working on these virtualenvs (the ansible version is using python3 and the virtualenv is only changing the python, not python3 version so it is not affecting it). If someone can help me with this I can start changing the python versions with pyenv to see which one will work with 4.8.0 (if this is indeed a python incompatibility issue)

the error message is below ( I am not certain it is due to the python incompatibility. It is a ModuleNotFound error)

(environment2) ubuntu@ip-172-31-21-52:~/course11_devops_startup/ansible$ ansible-playbook setup.yml

PLAY [main] ***********************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************
fatal: [linode..com]: FAILED! => {“ansible_facts”: {}, “changed”: false, “failed_modules”: {“ansible.legacy.setup”: {“ansible_facts”: {“discovered_interpreter_python”: “/usr/bin/python”}, “exception”: “Traceback (most recent call last):\r\n File "/root/.ansible/tmp/ansible-tmp-1725583372.7010815-98005-169407147453131/AnsiballZ_setup.py", line 100, in \r\n _ansiballz_main()\r\n File "/root/.ansible/tmp/ansible-tmp-1725583372.7010815-98005-169407147453131/AnsiballZ_setup.py", line 92, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File "/root/.ansible/tmp/ansible-tmp-1725583372.7010815-98005-169407147453131/AnsiballZ_setup.py", line 37, in invoke_module\r\n from ansible.module_utils import basic\r\n File "/tmp/ansible_ansible.legacy.setup_payload_zpd2pluy/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/basic.py", line 179, in \r\nModuleNotFoundError: No module named ‘ansible.module_utils.six.moves’\r\n”, “failed”: true, “module_stderr”: “Shared connection to 173.230.155.238 closed.\r\n”, “module_stdout”: “Traceback (most recent call last):\r\n File "/root/.ansible/tmp/ansible-tmp-1725583372.7010815-98005-169407147453131/AnsiballZ_setup.py", line 100, in \r\n _ansiballz_main()\r\n File "/root/.ansible/tmp/ansible-tmp-1725583372.7010815-98005-169407147453131/AnsiballZ_setup.py", line 92, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File "/root/.ansible/tmp/ansible-tmp-1725583372.7010815-98005-169407147453131/AnsiballZ_setup.py", line 37, in invoke_module\r\n from ansible.module_utils import basic\r\n File "/tmp/ansible_ansible.legacy.setup_payload_zpd2pluy/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/basic.py", line 179, in \r\nModuleNotFoundError: No module named ‘ansible.module_utils.six.moves’\r\n”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 1, “warnings”: ["Platform linux on host linode..com is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change the meaning of that path. See Interpreter Discovery — Ansible Core Documentation for more information."]}}, “msg”: “The following modules failed to execute: ansible.legacy.setup\n”}

warm regards
Dave

=========

Possibly. Since the Ansible Community Package depends on ansible-core, it inherits the Python requirements.

The ansible-core support matrix should help you there.

If you still run into problems… well, both Ansible 4.8 and ansible-core 2.11 are EOL :person_shrugging:

1 Like

hi Mario
I think you hit the nail on the head.

Relative to the matrix

The working venv has an ansible core with matching python client controller and matching target python
The failing venv has an ansible core with a matching client controller but a mismatched target python (it is way off. Should be up to 3.9 and I am running 3.12 which came with latest linode VPS Archlinux that I am using). So i think this is the problem.

i will possibly downgrade the target VPS python (I am guessing this will break things) or see if linode has an older Archlinux that i can use with the older python and build again from scratch, and let you know if it resolves the issue.

thanks and warm regards
Dave

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.