Warning in Ansible for Rocky but not for RHEL


I get the following warning in Rocky Linux 8.5 hosts, but not in RHEL 8.5 hosts, during gather facts of Ansible playbook.

[WARNING]: Platform linux on host myhostname is using the discovered Python
interpreter at /usr/bin/python3.9, but future installation of another Python
interpreter could change the meaning of that path. See
core/2.12/reference_appendices/interpreter_discovery.html for more information.

Why is this?

The problem is that under certain circumstances (Python > 3.6 installed) the platform detects that it is running on rocky, which was not hardcoded into ansible. I submitted a PR upstream which fixes this issue, should land in ansible 2.13


One does get the warning in AlmaLinux too – with Ansible 2.9 packaged by CentOS SIG and with only the platform_python (3.6) installed.

EL8 has semi-hidden platform_python, which will remain version 3.6 for the life of RHEL 8. System tools, like ‘dnf’ do use that Python.
On (minimal) install no Python is installed for the users. There are multiple streams available. The version 3.6 for users merely uses the platform_python; the other versions supply binaries.

On RHEL Ansible is presumably fixed to use the platform_python. On “unknown” distros it takes “first found” Python. Since that search result could change if different Python stream is installed, the behaviour of Ansible could be affected. Hence the warning?

1 Like

Thanks for the explanation and the PR. :+1: