How to daemonize better with Ansible?

Dear Ansible Community,

We are trying to migrate from one old system to Ansible. With old system, we are able to daemonize shell strings like this: exec -a clic /bin/sh -c “while :; do mkdir -p /local/clicop ; rsync -b --copy-links --timeout=5 -p /clic/clicbin /local/clicop/clic; ./clic; sleep 10; done”

With Ansible, I found only one way to do this:
name: execute diamon client

action: shell chdir=/local/diamonop /bin/sh -c “(while :; do mkdir -p /local/clicop; rsync -b --copy-links --timeout=5 -p /clic/clicbin /local/clicop/clic; ./clic; sleep 10; done;) >& /dev/null &”
async: 10
poll: 0

Is there any more elegant solution? Or it’s better to think about separate ansible module or setting like damonize: yes?

Thank you in advance and have a good day!

There are some good answers on this on Stack Overflow:

http://stackoverflow.com/questions/525247/how-do-i-daemonize-an-arbitrary-script-in-unix

Dear Michael,

Thank you for the response. As I’ve mentioned, the shell-way of doing things is not that interesting, because I’ve already worked it out. What I was thinking about is maybe there is some sort of module in ansible, which allows to daemonize process with specifying some sort of special tag like daemonize: yes or something similar. If there is no such tag or module dedicated for daemonization of the specified commands, maybe you have an idea, which existing module could be used as a basis for such task?

Thank you in advance and have good evening!