detachable ansible

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.

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

this looks interesting, thanks!

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.