SUMMARY
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 rolea
.
Some problems will happened if_version
is also defined byb
. And I have to know all inner variables ofb
-
I have to undefine
version
in roleb
Role b can’t have any default value ofversion
.
It seems hard to keep independent of role.