I was just looking to do the same thing. Michael's post clued me into what 
I was missing.

Specifically, I hadn't realized you can list your hosts more than once in 
the hosts file. That makes a site.yml file similar to:

- hosts: roleA
  roles:
    - roleA

- hosts: roleB
  roles:
    - roleB


Work to give you the same effect as we wanted with conditional roles. Just 
list the host under all the roles you want it to have in the groups file.

Thanks Michael!

On Monday, May 13, 2013 9:23:24 AM UTC-7, Yves Dorfsman wrote:
>
>
> Is this normal/expected? 
>
> I am trying to use conditional roles, and once it hits a negative 
> condition, 
> it skips every role afterwards: 
>
>
>      - hosts: all 
>        roles: 
>          - common 
>          - role: AppDynamics 
>            when: appdynamics 
>          - java 
>
> "appdynamics" is loaded as True/False from a group_vars, and is different 
> depending on the environment loaded (different inventories, group_vars 
> etc... 
> for PROD vs. TEST vs. DEV). 
>
> With the playbook above, the java role is skipped when appdynamic is 
> False. If 
> I move the java role above the AppDynamics role, then the java role never 
> gets 
> skipped. 
>
> Should the condition affect roles after it? 
>
>
> Thanks. 
>
> -- 
> Yves.                                                  
> http://www.SollerS.ca/ 
>                                   Unix/Linux and Python specialist in 
> Calgary. 
>                                                         
> http://blog.zioup.org/ 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f6e1f7bf-b63b-48f6-9d1c-9fd810f481af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to