summaryrefslogtreecommitdiff
path: root/lib/ansible/plugins/strategy/linear.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/plugins/strategy/linear.py')
-rw-r--r--lib/ansible/plugins/strategy/linear.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/ansible/plugins/strategy/linear.py b/lib/ansible/plugins/strategy/linear.py
index dc34e097bb..b2be0a1b10 100644
--- a/lib/ansible/plugins/strategy/linear.py
+++ b/lib/ansible/plugins/strategy/linear.py
@@ -170,10 +170,9 @@ class StrategyModule(StrategyBase):
# check to see if this task should be skipped, due to it being a member of a
# role which has already run (and whether that role allows duplicate execution)
- if not isinstance(task, Handler) and task._role and task._role.has_run(host):
- # If there is no metadata, the default behavior is to not allow duplicates,
- # if there is metadata, check to see if the allow_duplicates flag was set to true
- if task._role._metadata is None or task._role._metadata and not task._role._metadata.allow_duplicates:
+ if not isinstance(task, Handler) and task._role:
+ role_obj = self._get_cached_role(task, iterator._play)
+ if role_obj.has_run(host) and role_obj._metadata.allow_duplicates is False:
display.debug("'%s' skipped because role has already run" % task)
continue