--
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 ansible-project+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
Yves,I ran into the same issue with groups. If a host is a member of multiple groups (say "physical", "database", and "datacenter1"), and each group has the same variable, it will use the last one assigned (the last group the host is listed in within the inventory file). I think the key is that (as Michael mentioned) all variables are compiled and any collisions are all worked out in advance. One could argue that this is easier to debug, but I couldn't find where it was explicitly defined in the documentation. Maybe someone can point me in the right direction?Also, IIRC, there is a trumping order (so it isn't *just* whichever is last in the files). Like host vars trump group vars trump role vars or something like that. I think the trumping order is just a consequence of the "last assigned" characteristic (role is populated, then group, then host or something like that).
-pol
--
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 ansible-proje...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
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 ansible-proje...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Yves,I ran into the same issue with groups. If a host is a member of multiple groups (say "physical", "database", and "datacenter1"), and each group has the same variable, it will use the last one assigned (the last group the host is listed in within the inventory file). I think the key is that (as Michael mentioned) all variables are compiled and any collisions are all worked out in advance. One could argue that this is easier to debug, but I couldn't find where it was explicitly defined in the documentation. Maybe someone can point me in the right direction?
Also, IIRC, there is a trumping order (so it isn't *just* whichever is last in the files). Like host vars trump group vars trump role vars or something like that. I think the trumping order is just a consequence of the "last assigned" characteristic (role is populated, then group, then host or something like that).
-pol
On Thursday, May 2, 2013 9:32:11 AM UTC-6, Yves Dorfsman wrote:
--
I need to be extra careful since we have different people developing roles right now to be sure we don't stomp on each other's variable namespace.
--
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 ansible-proje...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
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 ansible-project+unsubscribe@googlegroups.com.
How is variable scope supposed to work with roles?
I have the same variable defined in different roles (say install_dir), when
running a playbook which includes several roles, the value assumed during the
execution of the tasks is always the one from the last defined role (the one
at the bottom of the list). I expected it to take its value from the
vars/main.yml for the role the task is defined in.
Is this how it is supposed to work, or a bug?
Thanks.
--
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 ansible-proje...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.