ansible icon indicating copy to clipboard operation
ansible copied to clipboard

ansible-core: future installation of another Python interpreter could change the meaning of that path

Open pingtouskar opened this issue 2 years ago • 9 comments

Summary

Ansible is giving the following warning evening though I have python interpreter already defined in the group vars in the inventory file:

[WARNING]: Platform linux on host webserver01 is using the discovered Python interpreter at /usr/bin/python3.10, but future installation of another Python interpreter could
change the meaning of that path. See https://docs.ansible.com/ansible-core/2.13/reference_appendices/interpreter_discovery.html for more information.

Issue Type

Bug Report

Component Name

ansible-core

Ansible Version

# pip3 show ansible
Name: ansible
Version: 6.6.0
Summary: Radically simple IT automation
Home-page: https://ansible.com/
Author: Ansible, Inc.
Author-email: [email protected]
License: GPLv3+
Location: /usr/lib/python3.10/site-packages
Requires: ansible-core
Required-by:

# pip3 show ansible-core
Name: ansible-core
Version: 2.13.6
Summary: Radically simple IT automation
Home-page: https://ansible.com/
Author: Ansible, Inc.
Author-email: [email protected]
License: GPLv3+
Location: /usr/lib/python3.10/site-packages
Requires: cryptography, jinja2, packaging, PyYAML, resolvelib
Required-by: ansible

Configuration

No specific ansible configuration

OS / Environment

Alpine Linux 3.17 Ubuntu Server 22.04 LTS

Steps to Reproduce

Try to run any ansible play that will use local connection to talk to a rhel7/8/9 guest vm.

- hosts: webserver
  connection: local
  tags: deploy
  gather_facts: no
  tasks:
    - name: Install required packages for http
      include_role:
        name: packageinstall
  • inventory file
[webserver]
xxx.xxx.xxx.xxx

# Node Groups
[nodes:children]
webserver

[nodes:vars]
ansible_connection=ssh
ansible_user=root
ansible_password=XXXXXXXX
ansible_python_interpreter=/usr/bin/python3
ansible_ssh_common_args='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'

Expected Results

Play should work without any warning as inventory is already having the ansible_python_interpreter=/usr/bin/python3 entry as required.

In the ansible provision server already have the path set for python as well:

bash-5.1# python
python      python3     python3.10
bash-5.1# which python
/usr/bin/python
bash-5.1# which python3
/usr/bin/python3
bash-5.1# which python3.10
/usr/bin/python3.10
bash-5.1#

Actual Results

[WARNING]: Platform linux on host webserver01 is using the discovered Python interpreter at /usr/bin/python3.10, but future installation of another Python interpreter could
change the meaning of that path. See https://docs.ansible.com/ansible-core/2.13/reference_appendices/interpreter_discovery.html for more information.

Code of Conduct

  • [X] I agree to follow the Ansible Code of Conduct

pingtouskar avatar Feb 28 '23 06:02 pingtouskar

Files identified in the description: None

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibot avatar Feb 28 '23 06:02 ansibot

Should that be the below instead?

 [nodes:children]
-webservers
+webserver

mkrizek avatar Feb 28 '23 15:02 mkrizek

Should that be the below instead?

 [nodes:children]
-webservers
+webserver

Nope. Thats the typo when I updated the issue. I have updated the issue description with correct group name.

In my environment, group name is all right. It has something to do with the interpreter and the way its being called.

pingtouskar avatar Mar 01 '23 05:03 pingtouskar

Hi, I too am receiving this error. The only difference is the device name and the python version.

[WARNING]: Platform linux on host 192.168.1.115 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
https://docs.ansible.com/ansible-core/2.12/reference_appendices/interpreter_discovery.html for more information.

I have a raspberry pi 4 with a clusterhat and 4 RPi zeros. The RPi4 doesnt report an error only the zeros.

ben@Dell-990:~/ansible_test$ ansible all -m shell -a "lsb_release -a"
192.168.1.101 | CHANGED | rc=0 >>
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseyeNo LSB modules are available.
192.168.1.111 | CHANGED | rc=0 >>
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseyeNo LSB modules are available.
[WARNING]: Platform linux on host 192.168.1.112 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
https://docs.ansible.com/ansible-core/2.12/reference_appendices/interpreter_discovery.html for more information.
192.168.1.112 | CHANGED | rc=0 >>
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseyeNo LSB modules are available.
[WARNING]: Platform linux on host 192.168.1.113 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
https://docs.ansible.com/ansible-core/2.12/reference_appendices/interpreter_discovery.html for more information.
192.168.1.113 | CHANGED | rc=0 >>
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseyeNo LSB modules are available.
[WARNING]: Platform linux on host 192.168.1.114 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
https://docs.ansible.com/ansible-core/2.12/reference_appendices/interpreter_discovery.html for more information.
192.168.1.114 | CHANGED | rc=0 >>
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseyeNo LSB modules are available.
[WARNING]: Platform linux on host 192.168.1.115 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
https://docs.ansible.com/ansible-core/2.12/reference_appendices/interpreter_discovery.html for more information.
192.168.1.115 | CHANGED | rc=0 >>
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseyeNo LSB modules are available.

let me know if you want logs to assist or further outputs that might help.

tehmessiah75 avatar Sep 12 '23 10:09 tehmessiah75

yarn run v1.22.19
$ ./devops/ansible/ansible.sh
[WARNING]: Invalid characters were found in group names but not replaced, use
-vvvv to see details
PLAY [prototype-web-app-ci] ****************************************************
TASK [Gathering Facts] *********************************************************
[WARNING]: Platform linux on host prototype-web-app-ci is using the discovered
Python interpreter at /venv/bin/python3.11, but future installation of another
Python interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible-
core/2.16/reference_appendices/interpreter_discovery.html for more information.
ok: [prototype-web-app-ci]
ERROR! [DEPRECATED]: ansible.builtin.include has been removed. Use include_tasks or import_tasks instead. This feature was removed from ansible-core in a release after 2023-05-16. Please update your playbooks.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Also getting this error following updating my Docker installation due to the "error: externally managed environment" issue listed here - https://stackoverflow.com/questions/75608323/how-do-i-solve-error-externally-managed-environment-every-time-i-use-pip-3

jamesryan-dev avatar Dec 15 '23 13:12 jamesryan-dev

To get rid of this warning, add interpreter_python=auto_silent to the [defaults] section in your ansible.cfg. See https://docs.ansible.com/ansible-core/2.17/reference_appendices/interpreter_discovery.html

prehor avatar Jun 18 '24 11:06 prehor