It seems hard to send a param into a role. The rule of vars is confusing.
`
What I want is overwrite version in role b by version in role a
roles/a/default/main.yml
version: v1.0.1
roles/a/tasks/main.yml
name: include role
include_role:
name: b
vars:
version: “{{ version }}”
roles/b/default/main.yml
version: “”
roles/b/tasks/main.yml
name: ouput version
debug:
var: version
`
EXPECTED RESULTS
I can pass the version variable into role b without any variable name changes of role b and a
ACTUAL RESULTS
I have to change version to _version in role a.
Some problems will happened if _version is also defined by b. And I have to know all inner variables of b
I have to undefine version in role b
Role b can’t have any default value of version.
'role defaults' are special, they do make them available for the rest
of the play but a role will always give priority to their own default
definition.