Add new host_pinned strategy (#44586)

The 'free' strategy still attempts to do all hosts per task before going to the next, it just doesn't wait for slow hosts,
This strategy processes each host as fast as possible to the end of the play before trying to process another host in the pool.
This commit is contained in:
Brian Coca
2018-08-23 20:16:32 -04:00
committed by GitHub
parent 3fb5056606
commit 9cc56981b5
7 changed files with 94 additions and 0 deletions

View File

@@ -18,3 +18,11 @@ env python -c \
'import sys, re; sys.stdout.write(re.sub("\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]", "", sys.stdin.read()))' \
<block_test.out >block_test_wo_colors.out
[ "$(grep -c 'TEST COMPLETE' block_test.out)" = "$(egrep '^[0-9]+ plays in' block_test_wo_colors.out | cut -f1 -d' ')" ]
# cleanup the output log again, to make sure the test is clean
rm -f block_test.out block_test_wo_colors.out
# run test with host_pinned strategy and again count the completions
ansible-playbook -vv main.yml -i ../../inventory -e test_strategy=host_pinned "$@" | tee block_test.out
env python -c \
'import sys, re; sys.stdout.write(re.sub("\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]", "", sys.stdin.read()))' \
<block_test.out >block_test_wo_colors.out
[ "$(grep -c 'TEST COMPLETE' block_test.out)" = "$(egrep '^[0-9]+ plays in' block_test_wo_colors.out | cut -f1 -d' ')" ]

View File

@@ -0,0 +1,2 @@
- set_fact:
inner_host_pinned: "reached"

View File

@@ -0,0 +1,6 @@
- name: this needs to be here
debug:
msg: "hello"
- include: inner.yml
with_items:
- '1'

View File

@@ -0,0 +1,9 @@
- hosts: testhost
gather_facts: no
strategy: host_pinned
roles:
- test_includes_host_pinned
tasks:
- assert:
that:
- "inner_host_pinned == 'reached'"

View File

@@ -3,3 +3,5 @@
- include: test_includes3.yml
- include: test_include_free.yml
- include: test_include_host_pinned.yml