Created
April 14, 2021 20:32
-
-
Save reyjrar/7fa04172e7851eab5f9236cf7856b391 to your computer and use it in GitHub Desktop.
Ansible bug with parameterized roles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PLAY [localhost] *************************************************************************************************************************** | |
TASK [Gathering Facts] ********************************************************************************************************************* | |
ok: [localhost] | |
TASK [Running for first] ******************************************************************************************************************* | |
TASK [bar : debug] ************************************************************************************************************************* | |
ok: [localhost] => { | |
"msg": "var_bar is second" | |
} | |
TASK [Running for second] ****************************************************************************************************************** | |
TASK [bar : debug] ************************************************************************************************************************* | |
ok: [localhost] => { | |
"msg": "var_bar is second" | |
} | |
PLAY RECAP ********************************************************************************************************************************* | |
localhost : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: localhost | |
connection: local | |
roles: | |
- role: foo | |
vars: | |
var_foo: 'first' | |
- role: foo | |
vars: | |
var_foo: 'second' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# tasks file for bar | |
- debug: | |
msg: "var_bar is {{ var_bar }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# tasks file for foo | |
- name: "Running for {{ var_foo }}" | |
include_role: | |
name: bar | |
vars: | |
var_bar: "{{ var_foo }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Notice the task names for each parameterized role inclusion have the corect value for
var_foo
.However, during the execution of the
include_role
,var_bar
is set for both the first and second invocation to the value ofvar_foo
in tthe last instance of the parameterized role.