Variables that are passed along when listing a dependency will override values for matching variables defined in defaults/main.yaml or vars/main.yaml. This can be useful for using a common role, such as an apache role, as a dependency while providing site-specific data such as what ports to open in the firewall or what apache modules to enable. Variables are expressed as additional keys to the role listing. Thus, continuing our hypothetical example, consider that we need to pass some variables to both the common and apache role dependencies we discussed:
--- dependencies: - role: common simple_var_a: True simple_var_b: False - role: apache complex_var: key1: value1 key2: value2 short_list: - 8080 - 8081
When providing dependency variable data, two names are reserved and should not be used as role variables: tags and when. The former is used to pass tag data into a role, and the latter is used to pass a conditional into the role.