Assuming the target machine is running a modern Linux version, you can run the "timeout" command in your shell.
Like: - shell: timeout -s 9 10 /usr/bin/command that does something That will send a "kill -9" to the command if it doesn't finish in 10 seconds. On Fri, Dec 28, 2018 at 10:53 AM Saravanan <[email protected]> wrote: > > Hi Ansible Experts, > We are running tasks using shell module. Sometime these tasks are pending due > to backend application server slow response. Is there anyway to set timeout > for these tasks to exit after certain time period? > > Regards > Saravanan > > -- > 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/53713c72-2f3d-4865-b105-6c25844e07b5%40googlegroups.com. > 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/CAFbiokc1ZsJP0apU_erOVmhc87K2qMMZCFG%2B9YRaKndG_Z1YiQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
