retries/loop for a bunch of tasks

Hi All,

how can I implement ‘retries:’ for a bunch of tasks. Unfortunately it does not work with ‘block:’ and i get the error: ‘ERROR! ‘until’ is not a valid attribute for a block’. Any idea or trick to get the result is highly welocomed.

tasks:

  • name: “execute show commands before Update”
    nxos_command:
    commands: “{{ item }}”
    ignore_errors: true
    with_items: “{{ todo }}”
    register: before_install

  • set_fact:
    out_before: “{{ out_before + [item.item] + item.stdout }}”
    with_items: “{{ before_install.results }}”

more tasks come here to do the Software Update…

  • name: “Check Output after update”
    block:

  • name: “execute show commands after Update”
    nxos_command:
    commands: “{{ item }}”
    ignore_errors: true
    with_items: “{{ todo2 }}”
    register: after_install

  • set_fact:
    error_data: “{{ ‘false’ if before_install == after_install else ‘true’}}”

retries: 3
delay: 300
until: error_data == ‘false’

You could put the tasks from the block in a separate file, and then
include that with include_tasks.
That does allow you to loop over it.