mirror of
https://github.com/ansible/ansible.git
synced 2026-08-01 00:34:56 +02:00
fix handling allow_duplicates with the role cache (#82691)
allow_duplicates is not part of the role uniqueness, so the value on the cached role may not match the current role. * remove the allow_duplicates check from Role.has_run() which operates on the deduplicated role * check the current role's allow_duplicates value in the strategy Co-authored-by: Martin Krizek <martin.krizek@gmail.com>
This commit is contained in:
co-authored by
Martin Krizek
parent
8704b9fc29
commit
b3d8cdde5d
@@ -121,6 +121,10 @@ ansible-playbook valid_include_keywords/playbook.yml "$@"
|
||||
ansible-playbook tasks/test_allow_single_role_dup.yml 2>&1 | tee test_allow_single_role_dup.out
|
||||
test "$(grep -c 'ok=3' test_allow_single_role_dup.out)" = 1
|
||||
|
||||
# Test allow_duplicate with include_role and import_role
|
||||
test "$(ansible-playbook tasks/test_dynamic_allow_dup.yml --tags include | grep -c 'Tasks file inside role')" = 2
|
||||
test "$(ansible-playbook tasks/test_dynamic_allow_dup.yml --tags import | grep -c 'Tasks file inside role')" = 2
|
||||
|
||||
# test templating public, allow_duplicates, and rolespec_validate
|
||||
ansible-playbook tasks/test_templating_IncludeRole_FA.yml 2>&1 | tee IncludeRole_FA_template.out
|
||||
test "$(grep -c 'ok=6' IncludeRole_FA_template.out)" = 1
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
- name: test for allow_duplicates with include_role
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tags:
|
||||
- include
|
||||
tasks:
|
||||
- include_role:
|
||||
name: dup_allowed_role
|
||||
allow_duplicates: false
|
||||
- include_role:
|
||||
name: dup_allowed_role
|
||||
- include_role:
|
||||
name: dup_allowed_role
|
||||
allow_duplicates: false
|
||||
|
||||
- name: test for allow_duplicates with import_role
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tags:
|
||||
- import
|
||||
tasks:
|
||||
- import_role:
|
||||
name: dup_allowed_role
|
||||
allow_duplicates: false
|
||||
- import_role:
|
||||
name: dup_allowed_role
|
||||
- import_role:
|
||||
name: dup_allowed_role
|
||||
allow_duplicates: false
|
||||
Reference in New Issue
Block a user