Thanks Kai. I had all the tasks running with own retries but i was hoping to have retries condition for multiple tasks or a bunch of tasks having single condition and retries. It is strange that there is no way to get that done.
On Mon, Mar 11, 2019, 7:35 PM Kai Stian Olstad < [email protected]> wrote: > On 06.03.2019 08:59, Ankit wrote: > > Ok, i tried this but *block* doesn't accept, *retries. > > If you have looked at the documentation I linked to you would see that > retries is not allowed for a block, only task. > So you need to move your retries to the individual tasks. > > > > *I have the > > following playbook currently. Here, until works but i am not able to > figure > > out a way to limit the max number of iterations: > > > > - hosts: all > > > > name: runLinuxSystemUpdate > > > > gather_facts: false > > > > tasks: > > > > - name: Set Facts if not present in Host. > > > > include: checkLinuxSystemUpdateStatusTask.yml > > > > when: ansible_facts['Missing_Hotfix_Patches'] is not defined or > > ansible_facts['Missing_Hotfix_Patches'] == "" > > > > - name: Iteration Block > > > > block: > > > > - name: Install Patches Block > > > > block: > > > > - name: Run InstallLinuxPatchesTask.yml Task File > > > > include: InstallLinuxPatchesTask.yml > > > > when: ansible_facts['Missing_Hotfix_Patches'] != '0' or > > ansible_facts['Missing_Security_Patches'] != '0' > > When you not using rescue and/or always in block just having one task in a > block has no meaning. > > > > > - name: Reboot Machines Block > > > > block: > > > > - name: Run RebootLinuxMachinesTask.yml Task File > > > > include: RebootLinuxMachinesTask.yml > > > > when: ansible_facts['Pending_Reboot'] == true > > Same here, this block has no meaning since it only on one task. > > > > - name: Run checkLinuxSystemUpdateStatusTask task file to > re-validate > > Update and Reboot Status > > > > include: checkLinuxSystemUpdateStatusTask.yml > > > > #when: update_result.stdout.find("The deployment of patches > and > > packages was successfully") == -1 > > > > until: ansible_facts['Missing_Hotfix_Patches'] != '0' and > > ansible_facts['Missing_Security_Patches'] != '0' > > *retries: 3* > > The retries you need to move to each task. > > -- > Kai Stian Olstad > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/130851ca-df0c-2656-e74e-849c2f6be5dd%40olstad.com > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CACecUhs30AQTGJw2UiPviOYhObT78fk_t9AYoxfGdD68KCaiFw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
