Ok, i tried this but *block* doesn't accept, *retries. *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'  

        - name: Reboot Machines Block

          block:

            - name: Run RebootLinuxMachinesTask.yml Task File

              include: RebootLinuxMachinesTask.yml

          when: ansible_facts['Pending_Reboot'] == true

        - 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*

*Regards,*
*Ankit*

On Monday, 25 February 2019 19:22:09 UTC+5:30, Kai Stian Olstad wrote:
>
> On 25.02.2019 13:55, Ankit wrote: 
> > What is the best and least time consuming way of doing this? I was 
> checking 
> > the documentation for *block *but i am not sure if i can use the 
> conditions 
> > for a block. 
> Why not just test it? 
> or check the documentation for what block support? 
>
> https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html#block
>  
>
> BTW when is the list. 
>
>
> -- 
> 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/4a26193e-0cbc-478d-9c37-8ca371375d14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to