Python interpreter problem on Ubuntu 16.04

Did you unset the ansible_python_interpreter in inventory? You wouldn’t need to; we just want to override apt and which will take precedence over inventory vars. If gather_facts doesn’t work in spite of specifying the python3.9 available your venv, I guess you’ll have to set the interpreter to python2 by default then.

The only alternative I see is to specifically install an older version of ansible on your control node to handle these. Since you seem to be familiar with venv’s already, you could make one specifically for installing an older version of ansible. I think ansible-core~=2.11.0 or ~=2.12.0 might be able to bridge the gap. `pip install “ansible>=4.0.0,<5.0.0” in your venv (or “ansible>=5.0.0,<6.0.0” for core 2.12) and see if it’s okay with the discovered interpreters. (if you’re using AWX/AAP, you can also create a custom EE with an older vs of ansible to do this)

Regardless, they definitely need to be upgraded or retired. I’m in a similar boat with RHEL 7 going EOL in June. Good luck!

1 Like