I’m new to Ansible and just started trying it out for use on some of my systems. I’m able to run a playbook against a remote machine, but when I try to run it locally it fails. In the playbook I’ve set host: 127.0.0.1 and connection: local.
This is what I see when it runs:
TASK: [test of local copy] *********************
failed: [127.0.0.1] => {“failed”: true, “parsed”: false}
FATAL: all hosts have already failed – aborting
I get the same failure when trying to run something on the localhost from the command line. Any ideas?
A few standard questions that we should always ask on reports like these:
(A) What version of Ansible? (That parsed message should appear with
a lot more detail) If this is not latest (1.0), please try latest.
(B) Have you tried -v -v -v, what was the output if you got any more detail?
(C) For starters, please supply your playbook, your inventory file,
and also the CLI invocation you are using. Redact them as neccessary,
but try to include as much as you can.
Michael, Thanks for the response. Here’s the additional information.
ansible --version reports 1.0. I’m running Arch Linux and this is the package from their AUR repository. Looks like it just clones the git repo for ansible and then builds it. The repo was as of 07 Jan.
You are getting an error while trying to run the setup module.
On the remote box, if you do a checkout of ansible and run
./hacking/env-setup -M setup, it should be able to help you see more
of what is going on.
It seems like you possibly might need to set
ansible_python_interpreter as an inventory variable seeing it's Arch
and python could be in a different place, but that's just a guess.
It should really report the full stderr output so I'm a bit unsure why
that is happening.
Good catch! Arch has python v.3 installed as python and python v.2 is python2. Specifying ansible_python_interpreter=/usr/bin/python2 in the hosts file solved the problem.