Hello,
today i try to split our grown ansible roles in more simple roles.
After do some work i realize that after rewrite and set some dependencies in our roles, some roles got executed multiple times.
So i google a bit and found an bug report (https://github.com/ansible/ansible/issues/5971) which descibe the same behavior.
The bug gets closed because of not reproducable and no further information.
So i recreate the simple test in comment nr. 4 and BAM…no duplicate running! After some testing i figured out the only difference to out plays.
The duplicate run is triggered if you add some tags to the play.
no duplicate run:
`
- name: role dep test sample
hosts: is
roles: - { role: base }
- { role: feature }
PLAY [role dep test sample] ***************************************************
TASK: [base | in base] ********************************************************
ok: [fw48b] => {
“msg”: “here we are in base”
}
TASK: [feature | in feature] **************************************************
ok: [fw48b] => {
“msg”: “here we are in feature”
}
PLAY RECAP ********************************************************************
`
duplicate run:
`
- name: role dep test sample
hosts: is
roles: - { role: base, tags: base }
- { role: feature, tags: feature }
PLAY [role dep test sample] ***************************************************
TASK: [base | in base] ********************************************************
ok: [fw48b] => {
“msg”: “here we are in base”
}
TASK: [base | in base] ********************************************************
ok: [fw48b] => {
“msg”: “here we are in base”
}
TASK: [feature | in feature] **************************************************
ok: [fw48b] => {
“msg”: “here we are in feature”
}
PLAY RECAP ********************************************************************
`
As we use tags to limit the runs with the “-t” switch, i can not discard this tags in our playbooks. So what can we do to workaround this behavior?
I don’t know how to reopen the bug.