Will it work - async + poll + with_items + include ?

267 views
Skip to first unread message

Mumshad Mannambeth

unread,
Sep 18, 2016, 8:46:59 PM9/18/16
to Ansible Project
Hi,

I am trying to run a long running task asynchronously and monitor results at the end. (My target are not windows. I am just passing in windows system information to target linux host)
My tasks don't run asynchronously. They run one after another. 

I include another file with two tasks in it that run one after another. 

What am I doing wrong here?


---
# Tasks File: main.yml
-
    name: 'IaaS Wndows Pre Requisites'
    include: iaas-windows-pre-requisites.yml
    tags:
        - iaas_windows_pre_requisites_check_and_fix_all
    vars:
        server_name: '{{item.server_name}}'
        server_role: '{{item.server_role}}'
    register: result
    async: 5400
    poll: 0
    with_items:
        - { server_name: '{{common.vra_web_primary_hostname}}', server_role: 'Website'}
        - { server_name: '{{common.vra_web_secondary_hostname}}', server_role: 'Website'}
        - { server_name: '{{common.vra_manager_primary_hostname}}', server_role: 'ManagerService'}
        - { server_name: '{{common.vra_manager_secondary_hostname}}', server_role: 'ManagerService'}
        - { server_name: '{{common.vra_proxy_agent_primary_hostname}}', server_role: 'Agent'}
        - { server_name: '{{common.vra_proxy_agent_secondary_hostname}}', server_role: 'Agent'}
        - { server_name: '{{common.vra_worker_primary_hostname}}', server_role: 'Dem'}
        - { server_name: '{{common.vra_worker_secondary_hostname}}', server_role: 'Dem'}
        

- name: Wait for all tasks to complete
  tags:
    - wait_for_all_iaas_pre_req_tasks_to_complete
  async_status: jid={{ item.ansible_job_id }}
  register: task_result
  until: task_result.finished
  retries: 180
  delay: 30
  with_items: "{{ result.results }}"
# -

Aman Vidura

unread,
Jun 21, 2017, 12:29:56 PM6/21/17
to Ansible Project
Hi Mumshad Mannambeth,

Any update on this issue? Were you able to resolve it?

Thanks!
Aman.
Reply all
Reply to author
Forward
0 new messages