-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
include_role on a loop running unexpected number of times #21279
Comments
confirmed the behaviour, it should run include_role per host but not for all hosts per host. |
ansible version: 2.4.0-100.git201703152001.517cdbe.devel But each role is played as many times as the number of hosts with it is specified in the inventory my roles and playbook: ds02.test.com
vs01.test.com
vs110.test.com
main role:
include task:
Actual result:role base played 3 times on every host each
played one time only for host with item in variable 'roles', but
|
Each item in loop runs twice. |
With this PR, #23104, and the below playbook:
I got the below output:
Each item in loop runs once in sequence, but this happened twice. |
Could this be a duplicate of #18748? |
I got distracted by the reference after comment about the duplicate. Yes, this is clearly a duplicate of #18748 |
Fixed in #30372 |
ISSUE TYPE
COMPONENT NAME
include_role
ANSIBLE VERSION
CONFIGURATION
/etc/ansible/hosts
OS / ENVIRONMENT
Ubuntu 14.04
SUMMARY
Using include_role in a loop seems to be executed twice: once with hosts, and another with the specified items.
STEPS TO REPRODUCE
ansible-playbook testPlaybook.yml
/usr/share/ansible/roles/testrole/tasks/main.yml
EXPECTED RESULTS
I expected to see testrole executed once, since I am only passing a single item to it
ACTUAL RESULTS
I see testrole executed twice
The text was updated successfully, but these errors were encountered: