Created
March 18, 2022 08:24
-
-
Save fffx/5951357ea986e78badae2cb447a1134d to your computer and use it in GitHub Desktop.
Ansible run multiple task in parallel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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