ansible ubuntu

How to run Ansible on Ubuntu 16.04?

If you visit my blog frequently, I always use Vagrant with Ansible for setting up my local development or provisioning a staging server.

This command

ansible-playbook -i inventories/staging playbook.yml

always working well for me but today I met this error

FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "\r\n/bin/sh: 1: /usr/bin/python: not found\r\n", "msg": "MODULE FAILURE", "parsed": false}

After spending time checking, Python 2.7 was not yet installed on Ubuntu 16.04 as it should be so Ansible could not run well.

How to run Ansible on Ubuntu 16.04?

It is quite easy to fix by just installing Python 2.7 with this command:

sudo apt-get install python-minimal
#checking ansible version
python --version
Python 2.7.12

After that, I could provision the LAMP stack successfully to deploy my new Magento website on an AWS Ubuntu 16.04 EC2 instance.

I hope this post can help you quickly resolve your issue.