# run a task before running everytask

**URL:** <https://forum.ansible.com/t/run-a-task-before-running-everytask/21570>\
**Category:** Ansible Project\
**Created:** [May 25, 2016, 11:46pm UTC](https://forum.ansible.com/t/run-a-task-before-running-everytask/21570 "2016-05-25T23:46:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steve\_Kieu1](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@Steve\_Kieu1](https://forum.ansible.com/u/Steve_Kieu1)\
**Post date:** [May 25, 2016, 11:46pm UTC](https://forum.ansible.com/t/run-a-task-before-running-everytask/21570/1 "2016-05-25T23:46:05Z")

</div>

Hi Team,

I have a bit silly question, is there a way to run a task before every tasks?

Like a hook but not in python.

My purpose is that I would insert a wait\_for the DNS to come up. Our DNS server is sometimes reloaded/restarted so when ansible get into a task at that exact bad time it will error right away with message: host not found. I want it to be a bit more resilient, saying if fail for dns wait a bit more and try again about 3 or 4 seconds before giving up.

Kind regards
