In this short article, we will explain how to solve the: “module_stderr“: “Shared connection to x.x.x.x closed.\r\n”, “module_stdout”: “/bin/sh: /usr/bin/python: No such file or directory\r\n”, while running Ansible commands.
The following screenshot shows the Ansible module error. We encountered this error while running an Ansible command to execute commands on two newly deployed CentOS 8 servers.
Ansible Module Error
From the error details, the connection failed because the shell(s) in the remote system couldn’t find the Python interpreter (/usr/bin/python) as indicated by the line: “module_stdout”: “/bin/sh: /usr/bin/python: No such file or directory\r\n“.
After checking the remote hosts, we discovered that the systems don’t have Python 2 installed.
Check Python Binary
They have Python 3 installed by default and its binary is /usr/bin/python3.
#ansible #questions #ansible tips #linux faq's #linux