Or option three: use async:.
http://docs.ansible.com/ansible/latest/playbooks_async.html


If the script is something you want to run and exit after performing its
tall, I think async is the most idiomatic.  If the script is more like a
daemon, having nohup in the script feels right to me but I can't think of a
reason either would be better.
-Toshio

On Jan 3, 2018 11:56 AM, "ZillaYT" <[email protected]> wrote:

> Say I want to run a script in the background after my Ansible run
> finishes. Which of these two options is the correct way?
>
> *Option 1: Run a nohup on the Ansible task itself*
> - name:Run a script in the background
>   command: nohup myscript.sh 2>&1  &
>
> where myscript.sh does something (anything) but has no nohup calls.
>
>
> *Option 2: Put the nohup in the script itself?*
> - name: Run a script in the background
>   command: ./myscript.sh
>
> and myscript.sh has in it the nohup
>
> *myscript.sh*
> nodup do_something 2>&1 &
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/70316e05-1357-40d8-aab4-53092dd8edc1%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/70316e05-1357-40d8-aab4-53092dd8edc1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAPrnkaQ5yr8QSpjm6jtbe63fsQGOtkcUK_-K_UgQykEmUtTOLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to