Ansible fails with /bin/sh: 1: /usr/bin/python: not found

Question:

I’m running into an error I’ve never seen before. Here is the command and the error:

Here is the create_api.yml file:

And here is the hosts file:

I can remove the roles section and it won’t make it to the first TASK, it will instead make it will only make it to the line /bin/sh: 1: /usr/bin/python: not found. What could be going on here?


Note: In case anyone is pinging the IP address and failing to get a response, you should know I’ve changed the IP address since pasting code.

Note:
python was installed locally, the problem was that it was not installed on the remote machine, which was running Ubuntu 15.04

Answer:

I stumbled upon this error running ansible on Ubuntu 15.10 server, because it ships with Python 3.4.3 and ansible requires Python 2.

This is how my provision.yml looks now:

  • Don’t forget the -y (says yes to all questions) option with apt-get (or raw module will get stuck silently)
  • gather_facts: no line is also critical (because we can’t gather facts without python)

Leave a Reply