But still, I think that a proper mechanism for role scoping should be 
implemented, if you try to reuse code odds are that you end up having 
several roles with several variables declared inside each job. Things like 
'path' or 'port' are expected to be declared inside those roles, either by 
vars statements while including or inside the role.

Imagine the following scenario

vars (vars/main.yml)
porrt:3000


metafile (meta/main.yml):
dependencies:
  - { role:nginx_server }

task (tasks/main.yml):
-include_role:
    unicorn_server
 args:
   listen: {{ port }} 
  

In the dependency you don't specify a role so an internal port variable is 
used (lets say port 80)

The second one has parameter that you set to port, but given that you 
misspelled it in the vars file you end up having an 80 here. This should be 
an 'undefined variable' because you should not bother with name clashing.

El jueves, 13 de julio de 2017, 15:54:06 (UTC+2), Brian Coca escribió:
>
> Actually, include_role is currently bugged in that it does NOT expose 
> the vars. So I would not rely on that behaviour. 
>
> ---------- 
> Brian Coca 
>

-- 
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/c8acdd1c-99ea-4797-bef3-a7abb93c7ce0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to