# Running playbook against local machine fails

**URL:** <https://forum.ansible.com/t/running-playbook-against-local-machine-fails/12206>\
**Category:** Ansible Project\
**Created:** [January 16, 2013, 8:14pm UTC](https://forum.ansible.com/t/running-playbook-against-local-machine-fails/12206 "2013-01-16T20:14:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dandm3](https://avatars.discourse-cdn.com/v4/letter/d/f4b2a3/32.png) [@dandm3](https://forum.ansible.com/u/dandm3)\
**Post date:** [January 16, 2013, 8:14pm UTC](https://forum.ansible.com/t/running-playbook-against-local-machine-fails/12206/1 "2013-01-16T20:14:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [January 16, 2013, 8:32pm UTC](https://forum.ansible.com/t/running-playbook-against-local-machine-fails/12206/2 "2013-01-16T20:32:07Z")

</div>

Do you have 127 in your hosts file?

Brian Coca

---

<div class="post-metadata">

**Author:** ![dandm3](https://avatars.discourse-cdn.com/v4/letter/d/f4b2a3/32.png) [@dandm3](https://forum.ansible.com/u/dandm3)\
**Post date:** [January 16, 2013, 8:39pm UTC](https://forum.ansible.com/t/running-playbook-against-local-machine-fails/12206/3 "2013-01-16T20:39:39Z")

</div>

Yes.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [January 16, 2013, 11:10pm UTC](https://forum.ansible.com/t/running-playbook-against-local-machine-fails/12206/4 "2013-01-16T23:10:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dandm3](https://avatars.discourse-cdn.com/v4/letter/d/f4b2a3/32.png) [@dandm3](https://forum.ansible.com/u/dandm3)\
**Post date:** [January 17, 2013, 2:05pm UTC](https://forum.ansible.com/t/running-playbook-against-local-machine-fails/12206/5 "2013-01-17T14:05:18Z")

</div>

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.

My hosts file:

> 127.0.0.1  
> src5

Output from running: ansible 127.0.0.1 -v -v -v -m setup --tree /tmp/facts --connection=local.

> \<127.0.0.1\> EXEC mkdir -p $HOME/.ansible/tmp/ansible-1358429770.6-229707097735235 && chmod a+rx $HOME/.ansible/tmp/ansible-1358429770.6-229707097735235 && echo $HOME/.ansible/tmp/ansible-1358429770.6-229707097735235  
> \<127.0.0.1\> REMOTE\_MODULE setup  
> \<127.0.0.1\> PUT /tmp/tmpw2MSzM TO /home/dan/.ansible/tmp/ansible-1358429770.6-229707097735235/setup  
> \<127.0.0.1\> EXEC /usr/bin/python /home/dan/.ansible/tmp/ansible-1358429770.6-229707097735235/setup; rm -rf /home/dan/.ansible/tmp/ansible-1358429770.6-229707097735235/ \>/dev/null 2\>&1  
> 127.0.0.1 | FAILED \>\> {  
> “failed”: true,  
> “msg”: “”,  
> “parsed”: false  
> }

My playbook:

> * * *
> 
> - name: example play  
> hosts: 127.0.0.1  
> connection: local  
> gather\_facts: no  
> user: dan
> 
> tasks:
> 
> - name: test of local copy  
> action: copy src=…/files/myconfig.conf dest=/home/dan

Running the playbook gives more or less the same error as running ansible in command-line mode.

Dan

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [January 17, 2013, 2:14pm UTC](https://forum.ansible.com/t/running-playbook-against-local-machine-fails/12206/6 "2013-01-17T14:14:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dandm3](https://avatars.discourse-cdn.com/v4/letter/d/f4b2a3/32.png) [@dandm3](https://forum.ansible.com/u/dandm3)\
**Post date:** [January 17, 2013, 4:06pm UTC](https://forum.ansible.com/t/running-playbook-against-local-machine-fails/12206/7 "2013-01-17T16:06:17Z")

</div>

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.

Thanks.
