Using "when" with dependent roles

36 views
Skip to first unread message

Andrew Martin

unread,
Feb 1, 2016, 6:45:51 PM2/1/16
to Ansible Project
Hello,

I recently upgraded to Ansible 2.0 and have noticed a change in behavior with how dependent roles in meta/main.yml are executed. For example:
dependencies:
 - { role: role1, when: trigger }
 - { role: role2, when: not trigger }

In Ansible 1.9, I could set trigger == True or trigger == False and only one of these two dependent roles would execute. Now, it doesn't seem to matter what trigger is set to, both are executed. Does the "when" conditional no longer work in dependent roles?

Thanks,

Andrew

Josh Smift

unread,
Aug 14, 2016, 7:31:15 PM8/14/16
to ansible...@googlegroups.com
AM> I recently upgraded to Ansible 2.0 and have noticed a change in behavior
AM> with how dependent roles in meta/main.yml are executed. For example:
AM> dependencies:
AM> - { role: role1, when: trigger }
AM> - { role: role2, when: not trigger }
AM>
AM> In Ansible 1.9, I could set trigger == True or trigger == False and
AM> only one of these two dependent roles would execute. Now, it doesn't
AM> seem to matter what trigger is set to, both are executed. Does the
AM> "when" conditional no longer work in dependent roles?

I had stashed this note away because we use this construction a fair bit,
and if it had stopped working in 2.x, we'd have a lot of refiguring to do.
It seems to work for us, though, in 2.1.1.0... Is it still not working for you?

-Josh (j...@care.com)



This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.
Reply all
Reply to author
Forward
0 new messages