# ansible Loop help

**URL:** <https://forum.ansible.com/t/ansible-loop-help/38771>\
**Category:** Ansible Project\
**Created:** [May 2, 2024, 11:36am UTC](https://forum.ansible.com/t/ansible-loop-help/38771 "2024-05-02T11:36:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thirumalairaja](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@thirumalairaja](https://forum.ansible.com/u/thirumalairaja)\
**Post date:** [May 2, 2024, 11:36am UTC](https://forum.ansible.com/t/ansible-loop-help/38771/1 "2024-05-02T11:36:13Z")

</div>

HI TEAM,

below is my task to check the job completed status for the set of ips, and for an ip approximately taking 15 mins to get the status. if i am having 5 number of ips its taking too long to complete my task.

so i am looking for parallel options to check for this particular task. is is passible to do that?  
if yes can anyone guide me pls.

- name: PPS Playbook Status  
pps\_check:  
vm\_ip: “{{ item }}”  
url: “[https://bldrapp.sys.comcast.net/api/v3/hosts/status?host-list=](https://bldrapp.sys.comcast.net/api/v3/hosts/status?host-list=)”  
register: status\_check  
with\_items: “{{available\_ips}}”  
tags:
- pps-status

---

<div class="post-metadata">

**Author:** ![John1](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@John1](https://forum.ansible.com/u/John1)\
**Post date:** [May 8, 2024, 10:56pm UTC](https://forum.ansible.com/t/ansible-loop-help/38771/2 "2024-05-08T22:56:13Z")

</div>

You mean something like this?

- name: Run status check  
pps\_check:  
vm\_ip: “{{ item }}”  
url: “[https://bldrapp.sys.comcast.net/api/v3/hosts/status?host-list=](https://bldrapp.sys.comcast.net/api/v3/hosts/status?host-list=)”  
register: status\_check  
with\_items: “{{ available\_ips }}”  
async: 900 # Adjust the timeout based on the expected maximum time to complete the task (15 minutes)  
poll: 0  
tags:

- pps-status

- name: Wait for all tasks to complete  
async\_status:  
jid: “{{ item.ansible\_job\_id }}”  
register: job\_result  
until: job\_result.finished  
retries: 30 # Adjust as needed  
delay: 60 # Adjust as needed  
with\_items: “{{ status\_check.results }}”  
tags:

- pps-status

- name: Gather results  
set\_fact:  
all\_results: “{{ all\_results | default() + [item] }}”  
loop: “{{ job\_result.results }}”  
tags:

- pps-status
