Created
October 4, 2022 13:08
-
-
Save s-hertel/b0f4c0d6a01d4e6eb4ffd4b0e8c03dbf to your computer and use it in GitHub Desktop.
test case for 78805
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
[pause_group0] | |
pause0 | |
pause1 | |
pause2 | |
[pause_group1] | |
pause3 | |
pause4 | |
pause5 | |
[pause_group2] | |
pause6 | |
pause7 | |
pause8 | |
[pause_group3] | |
pause9 | |
pause10 | |
pause11 | |
[pause_group4] | |
pause12 | |
pause13 | |
pause14 | |
[no_pause_group] | |
host0 | |
host1 | |
host2 | |
host3 | |
host4 | |
host5 | |
host6 | |
host7 | |
host8 | |
host9 | |
host10 | |
host11 | |
host12 | |
host13 | |
host14 | |
host15 | |
host16 | |
host17 | |
host18 | |
host19 | |
host20 | |
host21 | |
host22 | |
host23 | |
host24 | |
host25 | |
host26 | |
host27 | |
host28 | |
host29 | |
host30 | |
[pause_group0:vars] | |
sleep=1 | |
[pause_group1:vars] | |
sleep=2 | |
[pause_group2:vars] | |
sleep=3 | |
[pause_group3:vars] | |
sleep=4 | |
[pause_group4:vars] | |
sleep=5 | |
[pause:children] | |
pause_group0 | |
pause_group1 | |
pause_group2 | |
pause_group3 | |
pause_group4 | |
[all:children] | |
pause | |
no_pause_group | |
[all:vars] | |
run_count=0 | |
ansible_host=127.0.0.1 | |
ansible_connection=local |
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
- hosts: all | |
strategy: free | |
gather_facts: no | |
tasks: | |
- name: delay some hosts | |
wait_for: | |
timeout: "{{ hostvars[inventory_hostname]['sleep'] }}" | |
when: inventory_hostname in groups['pause'] | |
- name: Include 0 | |
include_tasks: | |
file: test_include.yml | |
vars: | |
some_var: 0 | |
- name: add a random pause | |
wait_for: | |
timeout: 1 | |
when: 10 | random > 5 | |
- name: Include 1 | |
include_tasks: | |
file: test_include.yml | |
vars: | |
some_var: 1 | |
- name: Include 2 | |
include_tasks: | |
file: test_include.yml | |
vars: | |
some_var: 2 | |
- name: Include 3 | |
include_tasks: | |
file: test_include.yml | |
vars: | |
some_var: 3 | |
- name: add a random pause | |
wait_for: | |
timeout: 1 | |
when: 10 | random > 5 | |
- name: Include 4 | |
include_tasks: | |
file: test_include.yml | |
vars: | |
some_var: 4 | |
- name: Include 5 | |
include_tasks: | |
file: test_include.yml | |
vars: | |
some_var: 5 | |
- name: Include 6 | |
include_tasks: | |
file: test_include.yml | |
vars: | |
some_var: 6 | |
- name: add a random pause | |
wait_for: | |
timeout: 1 | |
when: 10 | random > 5 | |
- name: Include 7 | |
include_tasks: | |
file: test_include.yml | |
vars: | |
some_var: 7 | |
- name: Include 8 | |
include_tasks: | |
file: test_include.yml | |
vars: | |
some_var: 8 | |
- name: Include 9 | |
include_tasks: | |
file: test_include.yml | |
vars: | |
some_var: 9 |
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
- debug: | |
msg: "{{ some_var }} == {{ hostvars[inventory_hostname]['run_count'] }}" | |
- assert: | |
that: hostvars[inventory_hostname]['run_count'] | int == some_var | |
- set_fact: | |
run_count: "{{ hostvars[inventory_hostname]['run_count'] | int + 1 }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment