nested loop

21 views
Skip to first unread message

fusillator

unread,
Feb 24, 2019, 1:49:35 PM2/24/19
to Ansible Project
hi all, is there a way to make nested loop without using include_tasks
I know it's possible to use with_nested, but how convert this manual example to use only one file?

#####################
# main.yml ##################### - name: Run items asynchronously in batch of two items vars: sleep_durations: - 1 - 2 - 3 - 4 - 5 durations: "{{ item }}" include_tasks: execute_batch.yml loop: - "{{ sleep_durations batch(2) list }}" ##################### # execute_batch.yml ##################### - name: Async sleeping for batched_items command: sleep {{ async_item }} async: 45 poll: 0 loop: "{{ durations }}" loop_control: loop_var: "async_item" register: async_results - name: Check sync status async_status: jid: "{{ async_result_item.ansible_job_id }}" loop: "{{ async_results.results }}" loop_control: loop_var: "async_result_item" register: async_poll_results until: async_poll_results.finished retries: 30
Reply all
Reply to author
Forward
0 new messages