include_role now allows duplicates by default

setting is overridable by user

(cherry picked from commit 38d0f77a0f)
This commit is contained in:
Brian Coca 2016-10-18 11:13:30 -04:00
parent f6295677c9
commit c5b155ba1a

View file

@ -47,6 +47,7 @@ class IncludeRole(Task):
# ATTRIBUTES
# private as this is a 'module options' vs a task property
_allow_duplicates = FieldAttribute(isa='bool', default=True, private=True)
_static = FieldAttribute(isa='bool', default=None, private=True)
_private = FieldAttribute(isa='bool', default=None, private=True)
@ -73,6 +74,7 @@ class IncludeRole(Task):
# build role
actual_role = Role.load(ri, myplay, parent_role=self._parent_role, from_files=self._from_files)
actual_role._metadata.allow_duplicates = self.allow_duplicates
# compile role
blocks = actual_role.compile(play=myplay)
@ -107,7 +109,7 @@ class IncludeRole(Task):
#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']:
for option in ['static', 'private', 'allow_duplicates']:
if option in ir.args:
setattr(ir, option, ir.args.get(option))