# async with connection local

**URL:** <https://forum.ansible.com/t/async-with-connection-local/12923>\
**Category:** Ansible Project\
**Created:** [June 7, 2013, 4:19pm UTC](https://forum.ansible.com/t/async-with-connection-local/12923 "2013-06-07T16:19:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jschulman](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@jschulman](https://forum.ansible.com/u/jschulman)\
**Post date:** [June 7, 2013, 4:19pm UTC](https://forum.ansible.com/t/async-with-connection-local/12923/1 "2013-06-07T16:19:25Z")

</div>

I am trying to use the async option on an action running in a playbook, like so:

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [June 7, 2013, 7:08pm UTC](https://forum.ansible.com/t/async-with-connection-local/12923/2 "2013-06-07T19:08:37Z")

</div>

It seems that async mode doesn’t like the way you are specifying arguments in long form.

action: junos\_install\_os \>  
hostname=“{{ inventory\_hostname }}”  
version=“{{ IMAGE\_TAGS[junos\_image\_tag].version }}”  
package=“{{ IMAGE\_TAGS[junos\_image\_tag].package }}”  
package\_dir=“{{ IMAGE\_DIR }}”  
reboot=True

Complex arguments were invented primarily for the needs of the cloudformation module, and since there are really no data structures  
being passed around here it seems ok to just use regular key=value data.

I’ll make a github ticket about this so we might have time to fix it later, but it seems it only would block a few limited use cases, and yours is not, at least yet, one of them.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [June 7, 2013, 7:22pm UTC](https://forum.ansible.com/t/async-with-connection-local/12923/3 "2013-06-07T19:22:17Z")

</div>

Ticket here: [https://github.com/ansible/ansible/issues/3150](https://github.com/ansible/ansible/issues/3150)

I do not anticipate this being closed for 1.2.

---

<div class="post-metadata">

**Author:** ![jschulman](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@jschulman](https://forum.ansible.com/u/jschulman)\
**Post date:** [June 9, 2013, 7:00pm UTC](https://forum.ansible.com/t/async-with-connection-local/12923/4 "2013-06-09T19:00:07Z")

</div>

After changing to the syntax you proposed, I get the following error:

TASK: [Junos OS install, please wait, this could take a bit …] \*\*\*\*\*\*\*\*\*\*\*\*\*\*  
failed: [vsrx\_blue] =\> {“ansible\_job\_id”: “363705553608”, “changed”: false, “cmd”: “/home/jeremy/.ansible/tmp/ansible-1370804287.26-173733122300989/junos\_install\_os /home/jeremy/.ansible/tmp/ansible-1370804287.26-173733122300989/arguments”, “failed”: 1, “finished”: 1}  
msg: [Errno 2] No such file or directory  
\<job 363705553608\> FAILED on vsrx\_blue

FATAL: all hosts have already failed – aborting

I appreciate any other suggestions, ideas you might have.

Thank you!  
– Jeremy

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [June 9, 2013, 11:21pm UTC](https://forum.ansible.com/t/async-with-connection-local/12923/5 "2013-06-09T23:21:19Z")

</div>

Hard to say without being able to run this module in my environment, but it’s not a syntax issue most likely – though I’d like to see what you are passing to the module to tell for sure (paste your playbook task line? and then show the output from running the playbook from -v -v -v)

It looks like the async\_wrapper code couldn’t find the status file it is used to writing, but adding some debugging inside async\_wrapper might not hurt.

possibly useful – if you export ANSIBLE\_KEEP\_REMOTE\_FILES=1 it will leave the files around on the remote system, and then you can execute the exact same command outside of the async code to see if you see any particular problems. I would be curious if it runs fine without async with the above approach on the remote system, when executed the same way.

I would also suggest poking around here:

[https://github.com/ansible/ansible/blob/devel/library/internal/async\_wrapper](https://github.com/ansible/ansible/blob/devel/library/internal/async_wrapper)

and

[https://github.com/ansible/ansible/blob/devel/library/internal/async\_status](https://github.com/ansible/ansible/blob/devel/library/internal/async_status)

You will notice some commented out syslogging in async\_wrapper that may provide a good facility for learning more about what is going on. You may want to add some more log lines, but any open() calls may be where you’re getting the exception.
