Variable precedence and why to over rule ?

Hello,

there is a quite simple setup I am sure many of us came across this:

  1. you have lean, slim and dedicate Roles
  2. every role has its own role vars
  3. playbooks include the roles

Up to this point nothing spezial

Now: lest assume you have an base path for an application, most likely you will need this path in many roles.
To keep the roles independent you would define this base path in every role vars where needed
Hm, now you include some roles in a playbook and in case of a change on e.g. the base path you need to change that in every role

One help would be to use extra vars to overrule the role vars But what if there are many potential candidates for a change??

So I would like to be able to include vars in a playbook to overrule the variables in the roles. But this is not possible
a) include_vars is not allowed in playbooks
b) var_files (what would work in playbooks) will be over written by role vars

Good question: how do you do solve this situation?? May be I want something odd and there is a much simpler way?

Thanks for any hint
Michael

Use defaults and not the vars folder in the role, then you can overwrite the variable anywhere you like.

OMG!
I complete over saw this. Thanks a lot!

Just to clarify some things that looked wrong:

- include_vars is allowed in plays, as a task
- vars_files is only allowed on plays, directly as a keyword
- you can pass files to extra vars by using the '@' symbol: -e
@filename.yml or -e @filname.json for when you data does not fit on
the command line itself