mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Don't ignore a duplicate host for an already processed include (#40361)
* Don't ignore a duplicate host for an already processed include, assume that the repetition indicates a new include. Fixes #40317 * Add intg tests to ensure duplicate items in loop are not deduped * Add note about relative indexing
This commit is contained in:
@@ -73,3 +73,9 @@ if [[ -z "$OUT" ]]; then
|
||||
echo "apply on import_tasks did not cause error"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test that duplicate items in loop are not deduped
|
||||
ANSIBLE_STRATEGY='linear' ansible-playbook tasks/test_include_dupe_loop.yml -i ../../inventory "$@" | tee test_include_dupe_loop.out
|
||||
test "$(grep -c 'item=foo' test_include_dupe_loop.out)" = 3
|
||||
ANSIBLE_STRATEGY='free' ansible-playbook tasks/test_include_dupe_loop.yml -i ../../inventory "$@" | tee test_include_dupe_loop.out
|
||||
test "$(grep -c 'item=foo' test_include_dupe_loop.out)" = 3
|
||||
@@ -0,0 +1,2 @@
|
||||
- debug:
|
||||
msg: "item={{ item }}"
|
||||
@@ -0,0 +1,8 @@
|
||||
- name: Test Include Duplicate Loop Items
|
||||
hosts: testhost
|
||||
tasks:
|
||||
- include_tasks: debug_item.yml
|
||||
loop:
|
||||
- foo
|
||||
- foo
|
||||
- foo
|
||||
Reference in New Issue
Block a user