Ansible Error: /bin/sh: 1: /usr/bin/python: not found

Unable to SSH on Ubuntu Server Greater than 14.04

You may encountered following error while doing ssh on Ubuntu server through Ansible


XX.XXX.XX.XXX | FAILED! => {


    "changed": false, 


    "failed": true, 


    "module_stderr": "Connection to XX.XXX.XX.XXX closed.rn", 


    "module_stdout": "/bin/sh: 1: /usr/bin/python: not foundrn", 


    "msg": "MODULE FAILURE"


}

It happens since newer version of Ubuntu comes with Python3 by default. And Ansible internally looks for python2. Hence to SSH, you need to install python2 on server manually. For this run following command on server:


sudo apt-get -y install python-simplejson
Now, you can ssh via Ansible on Ubuntu server greater than 14.04.

Leave a Reply

Your email address will not be published. Required fields are marked *