# Cannot get local connection to work

**URL:** <https://forum.ansible.com/t/cannot-get-local-connection-to-work/11731>\
**Category:** Ansible Project\
**Created:** [July 27, 2012, 12:44pm UTC](https://forum.ansible.com/t/cannot-get-local-connection-to-work/11731 "2012-07-27T12:44:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grzegorz\_Nosek](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@Grzegorz\_Nosek](https://forum.ansible.com/u/Grzegorz_Nosek)\
**Post date:** [July 27, 2012, 12:44pm UTC](https://forum.ansible.com/t/cannot-get-local-connection-to-work/11731/1 "2012-07-27T12:44:05Z")

</div>

Hi,

I started playing with ansible playbooks and hit a wall with local connections.

I was trying to gather some data (VM ssh keys to build a known\_hosts file) from a few hosts and postprocess them locally.

The playbook looks like:

---

<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:** [July 27, 2012, 12:48pm UTC](https://forum.ansible.com/t/cannot-get-local-connection-to-work/11731/2 "2012-07-27T12:48:58Z")

</div>

Plays have a connection parameter, not tasks.

The gist you linked to is not official documentation.

---

<div class="post-metadata">

**Author:** ![Grzegorz\_Nosek](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@Grzegorz\_Nosek](https://forum.ansible.com/u/Grzegorz_Nosek)\
**Post date:** [July 27, 2012, 12:54pm UTC](https://forum.ansible.com/t/cannot-get-local-connection-to-work/11731/3 "2012-07-27T12:54:35Z")

</div>

W dniu 27.07.2012 14:48, Michael DeHaan pisze:

> Plays have a connection parameter, not tasks.

OK.

> The gist you linked to is not official documentation.

I know, I hoped it wasn't wrong 😉 Still, what about the error trying to  
do anything with --connection local?

> > # ansible local --connection local -m ping  
> > 127.0.0.1 | FAILED \>\> {  
> > &nbsp;&nbsp;&nbsp;&nbsp;"failed": true,  
> > &nbsp;&nbsp;&nbsp;&nbsp;"module": "ping",  
> > &nbsp;&nbsp;&nbsp;&nbsp;"msg": "",  
> > &nbsp;&nbsp;&nbsp;&nbsp;"parsed": false  
> > }

Not sure how to start debugging this one (strace didn't prove too useful).

Best regards,  
Grzegorz Nosek

---

<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:** [July 27, 2012, 12:59pm UTC](https://forum.ansible.com/t/cannot-get-local-connection-to-work/11731/4 "2012-07-27T12:59:47Z")

</div>

> I know, I hoped it wasn’t wrong 😉 Still, what about the error trying to  
> do anything with --connection local?

For starters, are you using the latest git?

---

<div class="post-metadata">

**Author:** ![Grzegorz\_Nosek](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@Grzegorz\_Nosek](https://forum.ansible.com/u/Grzegorz_Nosek)\
**Post date:** [July 27, 2012, 1:08pm UTC](https://forum.ansible.com/t/cannot-get-local-connection-to-work/11731/5 "2012-07-27T13:08:53Z")

</div>

W dniu 27.07.2012 14:59, Michael DeHaan pisze:

> > I know, I hoped it wasn't wrong 😉 Still, what about the error trying to  
> > do anything with --connection local?
> 
> For starters, are you using the latest git?

Yes.

commit d55012e57030a085cc1ebbe6a7016dccdfa6c192  
Merge: 0c61d04... 9253d89...  
Author: Michael DeHaan \<michael.dehaan@gmail.com\>

&nbsp;&nbsp;&nbsp;&nbsp;Merge pull request #704 from lorin/gitfix

&nbsp;&nbsp;&nbsp;&nbsp;git module: Don't pass rc as separate arg to fail\_json

Updated a second ago (one commit was new), still the same.

If that matters, ansible lives in a private virtualenv (note: I had to  
add its lib subdirectory to a .pth file to run it at all).  
/usr/bin/python is 2.4.x, ansible is running on 2.7.x.

Best regards,  
Grzegorz Nosek
