ansible Loop help

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.

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