Skip to content

Instantly share code, notes, and snippets.

@fffx
Created March 18, 2022 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fffx/5951357ea986e78badae2cb447a1134d to your computer and use it in GitHub Desktop.
Save fffx/5951357ea986e78badae2cb447a1134d to your computer and use it in GitHub Desktop.
Ansible run multiple task in parallel
- name: Clone repositories
git: repo={{item.repo}} dest={{item.dest}} depth=1
loop:
- {repo: "{{git_server}}/project1.git", dest: "some where" }
- {repo: "{{git_server}}/project2.git", dest: "some where else" }
register: clone_result
async: 600
poll: 0
# - debug: var=clone_result
- name: Check on an async task
async_status:
jid: "{{ item.ansible_job_id }}"
register: job_result
until: job_result.finished
retries: 3
delay: 1
loop: '{{clone_result.results}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment