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.

On Wed, 3 Apr 2024 at 14:37, Azadeh Amirhosseini
<az.amirhosse...@gmail.com> wrote:
>
> 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 received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/2ab45753-43fe-431e-8ed4-891dde801db8n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF8BbLZnjfC5skj27pP_8-cwSJ-JZu52jWoZeiW7o70hvVxHsw%40mail.gmail.com.

Reply via email to