diff options
author | Brian Coca <bcoca@users.noreply.github.com> | 2018-05-01 10:16:59 -0400 |
---|---|---|
committer | Brian Coca <bcoca@users.noreply.github.com> | 2018-05-10 16:44:02 -0400 |
commit | 0cd5457ea25c67f4401ec50c5bb23944c43d0aed (patch) | |
tree | 1f3b0bb3a0f355caa97ad1a101b0d41131df312e | |
parent | 82abfa7ddf9d9b8e7fac1143d9ff35243e871a03 (diff) | |
download | ansible-0cd5457ea25c67f4401ec50c5bb23944c43d0aed.tar.gz |
remove properties from vars in include_role (#38968)
* remove properties from vars in include_role
* also from_ args
(cherry picked from commit b9f7f582d116d516a5fcad80dee25c341650676e)
-rw-r--r-- | changelogs/fragments/remove_key_from_vars.yml | 2 | ||||
-rw-r--r-- | lib/ansible/playbook/included_file.py | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/changelogs/fragments/remove_key_from_vars.yml b/changelogs/fragments/remove_key_from_vars.yml new file mode 100644 index 0000000000..eb5e4416b0 --- /dev/null +++ b/changelogs/fragments/remove_key_from_vars.yml @@ -0,0 +1,2 @@ +- bugfixes: + - disambiguate keywords from variables in include_role https://github.com/ansible/ansible/pull/38968 diff --git a/lib/ansible/playbook/included_file.py b/lib/ansible/playbook/included_file.py index 55686199ac..548e4ffde6 100644 --- a/lib/ansible/playbook/included_file.py +++ b/lib/ansible/playbook/included_file.py @@ -142,7 +142,7 @@ class IncludedFile: inc_file = IncludedFile(include_file, include_variables, original_task) else: # template the included role's name here - role_name = include_variables.get('name', include_variables.get('role', None)) + role_name = include_variables.pop('name', include_variables.pop('role', None)) if role_name is not None: role_name = templar.template(role_name) @@ -151,7 +151,7 @@ class IncludedFile: for from_arg in new_task.FROM_ARGS: if from_arg in include_variables: from_key = from_arg.replace('_from', '') - new_task._from_files[from_key] = templar.template(include_variables[from_arg]) + new_task._from_files[from_key] = templar.template(include_variables.pop(from_arg)) inc_file = IncludedFile("role", include_variables, new_task, is_role=True) |