Created
January 10, 2020 19:31
-
-
Save goneri/b5c3a9b30e4768c6859303778ca86402 to your computer and use it in GitHub Desktop.
split-up ansible-test role list
This file contains 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
- hosts: localhost | |
vars: | |
split_in: 4 | |
do_number: 1 # 1 to 4 | |
tasks: | |
- command: 'ansible-test integration --python 3.7 -vvv --list-targets zuul/vmware/vcenter_1esxi/' | |
register: ansible_test_targets | |
- set_fact: | |
number_entries: "{{ ansible_test_targets.stdout_lines|length }}" | |
- set_fact: | |
start_at: "{{ number_entries|int // split_in * (do_number -1)|int }}" | |
end_at: "{{ (number_entries|int // split_in * (do_number |int)) }}" | |
- debug: | |
msg: "Do roles: {{ ansible_test_targets.stdout_lines[start_at|int:end_at|int] }}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment