0

How to Fix “Shared connection to x.x.xx closed” Ansible Error

Tried to run an Ansible playbook whilst accessing the server with a private key
However, I am getting this error:
fatal: [xxx]: FAILED! => { "changed": false, "failed": true, "invocation": { "module_name": "setup" }, "module_stderr": "Shared connection to xxx closed.\r\n", "module_stdout": "/bin/sh: 1: /usr/bin/python2.7: not found\r\n", "msg": "MODULE FAILURE" }

Ansible Error-handling Add a comment
michael
asked Nov 06 2021

Answer

0

The error message you get is:
/usr/bin/python2.7: not found
Ansible requires the target machine to have Python installed in order to work properly
If Python 2.7 is installed in a different directory, you can add a host variable, for example in your inventory file (assuming the hostname is xxx as in your question`):

xxx ansible_python_interpreter=/path/to/python2.7

To run modules with Python 3 (experimental), set:

xxx ansible_python_interpreter=/usr/bin/python3

Add a comment
linuxhelp
asked Nov 06 2021
edited Nov 06 2021
Post your Answer