Do-until loop with an include task

Community,

I’m trying to loop through a tasks script until a task check does not fail. This is what I’d like to use:

  • name: Retry startup
    include: retry.yml
    when: check|failed
    retries: 3
    until: not check|failed

The retry.yml script registers ‘check’ again to verify that the startup is successful. However, upon execution, only the first task in the retry.yml script gets run, the rest of the tasks are skipped entirely. Is this a bug/deficiency of the “include” module? I’d like the whole script to be retried instead of the first task. The method below functions, and does what I want but is not as clean.

  • name: Retry startup
    include: retry.yml
    when: check|failed

  • name: Retry startup
    include: retry.yml
    when: check|failed

  • name: Retry startup
    include: retry.yml
    when: check|failed

I know that ansible does not allow inlcude tasks to use ‘with_items’ or any sort of looping, I assume this is related.

Thanks,
Chip

Yes, this won’t work. Include is not a module, more like a preprocessing macro.