From 2b02e8e2b43a7b5e10e0c12b0bbecedfb00f50c0 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Sun, 24 Jan 2016 23:02:55 -0500 Subject: [PATCH] Allow certain base attributes to be used as role params Role definitions typically require params to be different from those which are specified as FieldAttributes on the playbook classes used for roles, however a certain subset should be allowed (typically those used for connection stuff). Fixes #14095 --- lib/ansible/playbook/role/definition.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ansible/playbook/role/definition.py b/lib/ansible/playbook/role/definition.py index 0af49cec91c..ac7f40050c4 100644 --- a/lib/ansible/playbook/role/definition.py +++ b/lib/ansible/playbook/role/definition.py @@ -188,7 +188,12 @@ class RoleDefinition(Base, Become, Conditional, Taggable): for (key, value) in iteritems(ds): # use the list of FieldAttribute values to determine what is and is not # an extra parameter for this role (or sub-class of this role) - if key not in base_attribute_names: + # FIXME: hard-coded list of exception key names here corresponds to the + # connection fields in the Base class. There may need to be some + # other mechanism where we exclude certain kinds of field attributes, + # or make this list more automatic in some way so we don't have to + # remember to update it manually. + if key not in base_attribute_names or key in ('connection', 'port', 'remote_user'): # this key does not match a field attribute, so it must be a role param role_params[key] = value else: