Run sequence of tasks until success

Is there a way to run a block of tasks until successful condition? This is what I am trying to achieve:
- start sequence below
      task running shell command to generate kerberos ticket
      task wait_for_connection
   retry sequence x times until wait_for connection is successful

What is the best way to achieve it?It seems that 'block' is not designed for this purpose.