From 54ce6a9b7a7d2b1d4dc712c74f58fda5f55a780a Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 3 Oct 2016 19:24:37 -0400 Subject: [PATCH] fix for include_role conflating vars/directives --- lib/ansible/playbook/role_include.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/ansible/playbook/role_include.py b/lib/ansible/playbook/role_include.py index e67d0d7f0e..f6737c0793 100644 --- a/lib/ansible/playbook/role_include.py +++ b/lib/ansible/playbook/role_include.py @@ -92,22 +92,25 @@ class IncludeRole(Task): ir = IncludeRole(block, role, task_include=task_include).load_data(data, variable_manager=variable_manager, loader=loader) + # deal with options + + # name is needed ir._role_name = ir.args.get('name') if ir._role_name is None: raise AnsibleParserError("'name' is a required field.") - # set built in's - attributes = frozenset(ir._valid_attrs.keys()) - for builtin in attributes: - if ir.args.get(builtin): - setattr(ir, builtin, ir.args.get(builtin)) - # build options for role includes for key in ['tasks', 'vars', 'defaults']: from_key = key + '_from' if ir.args.get(from_key): ir._from_files[key] = basename(ir.args.get(from_key)) + #TODO: find a way to make this list come from object ( attributes does not work as per below) + # manual list as otherwise the options would set other task parameters we don't want. + for option in ['static', 'private']: + if option in ir.args: + setattr(ir, option, ir.args.get(option)) + return ir.load_data(data, variable_manager=variable_manager, loader=loader) def copy(self, exclude_parent=False, exclude_tasks=False):