I'm running into an error I've never seen before. Here is the command and the error:
$ ansible-playbook create_api.yml
PLAY [straw] ******************************************************************
GATHERING FACTS ***************************************************************
failed: [104.55.47.224] => {"failed": true, "parsed": false}
/bin/sh: 1: /usr/bin/python: not found
TASK: [typical | install required system packages] *****************************
FATAL: no hosts matched or all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/Users/john/create_api.retry
104.55.47.224 : ok=0 changed=0 unreachable=0 failed=1
Here is the create_api.yml file:
---
- hosts: api
remote_user: root
roles:
- api
And here is the hosts file:
[api]
104.55.47.224
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.
EDIT python was installed locally, the problem was that it was not installed on the remote machine, which was running Ubuntu 15.04
I had the same issue, until I realised you also need to install python on the remote host as well as your own local machine. now it works!
Lots of answers.. Thanks for posting as I got started from this page too!
I did a bit of digging and it was solid with Ubuntu 14.04LTS, Ubuntu 15.04LTS appeared to have dropped the latest
python
, and Ubuntu 16.04LTS appears to have droppedaptitude
.I put the following action in my bootstrap before doing any
apt
calls:If you manage
become
elsewhere, feel free to strip it.Sources:
Ansible 2.2 features a tech preview of Python 3 support. To take advantage of this (so you don't have to install Python 2 on Ubuntu 16.04), just set the
ansible_python_interpreter
config option to/usr/bin/python3
. This can be done on a per-host basis in your inventory file:You can use the raw module to install Python on the remote hosts:
What I used to get this working on ubuntu 15.10 on a fresh Digital Ocean droplet:
For ubuntu 16.04 on a fresh OVH SSD, I had to apt-get upgrade before the python2 packages were available.
We just run into this.
We deploy ubuntu 16.04 on a vagrant so if you are not using vagrant my comment is pointless.
We installed the following vagrant plugins (trigger, shell-commander) and we get python 2.7.6 installed on the machine (which were not without thioose plugins) and after ansible can deploy
It was our last test, otherwise we were about to include this installation in a shell command in the Vagrant file
Hope it can help someone