On Tuesday, July 1, 2014 6:43:32 PM UTC-7, Michael DeHaan wrote:
>
> "Ansible variables seem to have a global scope, because if I set one 
> within the role it seems to be visible to all roles"
>
> No exactly true for roles.
>
> Ansible variables set in one role are available in roles further down so 
> you can have roles that describe an environment, but they do have scope. 
>  In fact, you are guaranteed access to that particular value, without it 
> being clobbered.
>

When you say "further down", are you referring to:

1. further down in a hierarchy (i.e.: a parent/child relationship where 
role A depends on role B so that role B is "further down" than role A in a 
hierarchy) 
2. further down in a sequential flow (i.e.: role A is applied and then role 
B so role B is "further down" in the playbook)

?

Talking with a colleague, I was assuming #1 and he was assuming #2.

I created a git repo that illustrates some behavior that surprised me. Most 
likely this is because I'm misunderstanding the paradigms at play; there's 
a small chance that it's a bug, but I figure the misunderstanding is more 
likely.

https://github.com/msabramo/ansible-roles-example

I would love to see an explanation of why this works the way it does so 
that I can have a deeper understanding of Ansible.

Thanks!
Marc

-- 
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/d913befd-afde-4c1c-86a6-ea41523eef39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to