diff options
Diffstat (limited to 'lib/ansible/plugins/strategy/free.py')
-rw-r--r-- | lib/ansible/plugins/strategy/free.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/ansible/plugins/strategy/free.py b/lib/ansible/plugins/strategy/free.py index 6f45114b1e..6d1aa651d8 100644 --- a/lib/ansible/plugins/strategy/free.py +++ b/lib/ansible/plugins/strategy/free.py @@ -173,10 +173,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, host=host_name) del self._blocked_hosts[host_name] continue |