# detachable ansible

**URL:** <https://forum.ansible.com/t/detachable-ansible/28263>\
**Category:** Ansible Developer\
**Created:** [August 5, 2018, 6:51pm UTC](https://forum.ansible.com/t/detachable-ansible/28263 "2018-08-05T18:51:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pixel\_fairy](https://avatars.discourse-cdn.com/v4/letter/p/6f9a4e/32.png) [@pixel\_fairy](https://forum.ansible.com/u/pixel_fairy)\
**Post date:** [August 5, 2018, 6:51pm UTC](https://forum.ansible.com/t/detachable-ansible/28263/1 "2018-08-05T18:51:42Z")

</div>

just had a funny thought. running a task in ansible kinda looks like this

ansible copies module and vars to server  
ansible starts the module and waits for stdout and std error  
ansible gets output, it shows you and reports success or failure

for long modules or bad connections,

ansible journals what its about to do

ansible copies module and vars to server  
ansible checks to see if that module and vars are already running

ansible starts the module detached from the controlling terminal and polls for output

user detaches or loses connection

laptop$ ansible-resume bar.yml

front ends like tower can check in once in a while, maybe report on progress.

but, the extra steps would reduce ansibles simplicity. ansible is the last tool where we want more moving parts to break. thought of a couple other ways to get this detached effect. fair amount that can go wrong with keys/certs in a remote tmux session. could also make an ephemeral container that runs the play and deletes itself. but then youd also need a controlling process to clean up after it if anything goes wrong. more complexity.

some people i work with have to manage sites on islands with unreliable connections. ansible tower or something like that to manage these detached plays would be good for that.

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [August 5, 2018, 8:01pm UTC](https://forum.ansible.com/t/detachable-ansible/28263/2 "2018-08-05T20:01:29Z")

</div>

> but, the extra steps would reduce ansibles simplicity. ansible is the last  
> tool where we want more moving parts to break. thought of a couple other  
> ways to get this detached effect. fair amount that can go wrong with  
> keys/certs in a remote tmux session. could also make an ephemeral container  
> that runs the play and deletes itself. but then youd also need a  
> controlling process to clean up after it if anything goes wrong. more  
> complexity.
> 
> some people i work with have to manage sites on islands with unreliable  
> connections. ansible tower or something like that to manage these detached  
> plays would be good for that.

you should have a look at the mitogen project, I think

---

<div class="post-metadata">

**Author:** ![pixel\_fairy](https://avatars.discourse-cdn.com/v4/letter/p/6f9a4e/32.png) [@pixel\_fairy](https://forum.ansible.com/u/pixel_fairy)\
**Post date:** [August 5, 2018, 8:08pm UTC](https://forum.ansible.com/t/detachable-ansible/28263/3 "2018-08-05T20:08:31Z")

</div>

this looks interesting, thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [August 6, 2018, 9:42pm UTC](https://forum.ansible.com/t/detachable-ansible/28263/4 "2018-08-06T21:42:56Z")

</div>

or at the async keyword, it works as you describe.

one point, Ansible never copies vars to the target, it only passes the  
info to the options the module requires, no more, no less.

modules don't deal with vars handling/templating, the core engine  
does, modules only deal with the input in their options.
