Start Cloudformation stacks in parallel from ansible -
i starting multiple cloudformation stacks in "with_items" loop in ansible this:
- name: create cf stack in aws cloudformation: stack_name: "{{ item.name }}" state: "present" template: "{{ item.name }}.py.json" template_parameters: "{{ item.template_parameters }}" with_items: "{{ cf_template_items }}"
can somehow make ansible start stacks in parallel?
using asynchronous tasks in fire-and-forget scheme (and waiting them finish in separate task) should work since ansible 2.0:
- name: create cf stack in aws async: 100 poll: 0 cloudformation: stack_name: "{{ item.name }}" state: "present" template: "{{ item.name }}.py.json" template_parameters: "{{ item.template_parameters }}" with_items: "{{ cf_template_items }}" register: cf_stack_async_results - async_status: jid: "{{item.ansible_job_id}}" with_items: cf_stack_async_results.results register: cf_stack_async_poll_results until: cf_stack_async_poll_results.finished retries: 30
Comments
Post a Comment