Shared connection to host closed
I launched 2 Ubuntu servers in AWS. Ansible installed on one server and also done ssh keygen
to connect to another remote server (2). Whenever I'm trying to ping the server through Ansible (command: ansible servername -m ping
). I am getting an error that the connection to the host was closed and /usr/bin/python
not found.
This is the error message:
172.XX.XX.XXX | FAILED! => {
"changed": false,
"module_stderr": "Shared connection to 172.XX.XX.XXX closed.\r\n",
"module_stdout": "/bin/sh: 1: /usr/bin/python: not found\r\n",
"msg": "MODULE FAILURE",
"rc": 0
}
I had a similar problem when configure digital ocean on Ubuntu 18.04 VM
I set in your local ansible inventory file the python3 interpreter
[all:vars]
ansible_python_interpreter = /usr/bin/python3
after that all worked fine.