run a task before running everytask

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