Ansible async module issue

I am working on an ansible playbook, which runs a shell script in async ( poll = 0 ) mode.

This shell script, which runs on remote host #1, calls a python program on remote host #2, which runs for a long duration.

So the flow is something like: ansible ----> shell script on remote host #1 ----> python script on remote host #2 ( could run for a long duration )

After the python script is done executing, it writes data into files, and those file are to be copied into the #1 host from #2 using the same shell script triggered on #1 host, using “wait” command in shell script.

The #1 host shell script executes thoroughly when run from the terminal manually, and the files are copied.

But when I try this using async, and provide and async: 100 seconds time, the shell script on #1 host runs only for 100 seconds, and the shell script stops, while the python script could run for more than that duration.

Is this behavior expected? Is there a way to “fire and forget” the shell script, so that it runs for more than the async duration?

I am working on an ansible playbook, which runs a shell script in async ( poll = 0 ) mode.

This shell script, which runs on remote host #1, calls a python program on remote host #2, which runs for a long duration.

So the flow is something like: ansible ----> shell script on remote host #1 ----> python script on remote host #2 ( could run for a long duration )

After the python script is done executing, it writes data into files, and those file are to be copied into the #1 host from #2 using the same shell script triggered on #1 host, using "wait" command in shell script.

The #1 host shell script executes thoroughly when run from the terminal manually, and the files are copied.

But when I try this using async, and provide and async: 100 seconds time, the shell script on #1 host runs only for 100 seconds, and the shell script stops, while the python script could run for more than that duration.

Is this behavior expected? Is there a way to "fire and forget" the shell script, so that it runs for more than the async duration?

Yes, this is expected. The async: parameter is the timeout value
meaning "this is the longest I should wait for that async task to
complete before moving on" however the "moving on" part of that often
has implications on the remote host because the parent process should
go away when the module executing on the remote machine exits after
the timeout value is met.

If you want to allow it to run for a very long time, just jump that
number up to a high number like 14400 which would be 4 hours (in
seconds).

-AdamM