Discovery python Interpreter failed
Closed this issue · 2 comments
Hi, I have a problem when using the wrapper :
ansible version : 2.11.3
python version 3.9.5
I have installed it with pip
It seems to fail when trying to discover the python interpreter :
When using ansible without the bastion :
ansible all -i host_ip, -u root -m ping
host_ip | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
When using the bastion :
export BASTION_USER="bastion_user"
export BASTION_HOST="bastion_ip"
export BASTION_PORT=22
export ANSIBLE_PIPELINING=1
export ANSIBLE_SCP_IF_SSH="True"
export ANSIBLE_PRIVATE_KEY_FILE="${HOME}/.ssh/id_ed25519"
export ANSIBLE_SSH_EXECUTABLE="${HOME}/Ansible/bastion/sshwrapper.py"
export ANSIBLE_SCP_EXECUTABLE="${HOME}/Ansible/bastion/scpbastion.sh"
ansible all -i host_ip, -u root -m ping
host_ip | FAILED! => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"module_stderr": "/bin/sh: 1: /usr/bin/python: not found\n",
"module_stdout": "",
"msg": "The module failed to execute correctly, you probably need to set the interpreter.\nSee stdout/stderr for the exact error",
"rc": 127
}
But when I try to connect with modifying the python interpreter of ansible :
ansible.cfg
interpreter_python=/usr/bin/python3
ansible all -i host_ip, -u root -m ping
host_ip | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
This is a problem because we have hosts that have not python 3 installed but only python 2 and ansible works with that.
I think that this is the same problem has : #2
Sorry about the delay! Can you try with the current main branch? We've just merged #8 that references python3 explicitly
Hi,
I have resolved the problem by setting the group_vars to :
ansible_python_interpreter: /usr/bin/python3
Thanks