mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-16 01:45:25 -07:00
Track role execution per-host, not overall in the role
Fixes #11863 Fixes #11878
This commit is contained in:
parent
fb5003dbfc
commit
adb9d7e461
5 changed files with 14 additions and 20 deletions
|
@ -80,8 +80,8 @@ class Role(Base, Become, Conditional, Taggable):
|
|||
self._handler_blocks = []
|
||||
self._default_vars = dict()
|
||||
self._role_vars = dict()
|
||||
self._had_task_run = False
|
||||
self._completed = False
|
||||
self._had_task_run = dict()
|
||||
self._completed = dict()
|
||||
|
||||
super(Role, self).__init__()
|
||||
|
||||
|
@ -303,13 +303,13 @@ class Role(Base, Become, Conditional, Taggable):
|
|||
block_list.extend(self._handler_blocks)
|
||||
return block_list
|
||||
|
||||
def has_run(self):
|
||||
def has_run(self, host):
|
||||
'''
|
||||
Returns true if this role has been iterated over completely and
|
||||
at least one task was run
|
||||
'''
|
||||
|
||||
return self._had_task_run and self._completed and not self._metadata.allow_duplicates
|
||||
return host.name in self._completed and not self._metadata.allow_duplicates
|
||||
|
||||
def compile(self, play, dep_chain=[]):
|
||||
'''
|
||||
|
@ -348,8 +348,8 @@ class Role(Base, Become, Conditional, Taggable):
|
|||
res['_role_vars'] = self._role_vars
|
||||
res['_role_params'] = self._role_params
|
||||
res['_default_vars'] = self._default_vars
|
||||
res['_had_task_run'] = self._had_task_run
|
||||
res['_completed'] = self._completed
|
||||
res['_had_task_run'] = self._had_task_run.copy()
|
||||
res['_completed'] = self._completed.copy()
|
||||
|
||||
if self._metadata:
|
||||
res['_metadata'] = self._metadata.serialize()
|
||||
|
@ -373,8 +373,8 @@ class Role(Base, Become, Conditional, Taggable):
|
|||
self._role_vars = data.get('_role_vars', dict())
|
||||
self._role_params = data.get('_role_params', dict())
|
||||
self._default_vars = data.get('_default_vars', dict())
|
||||
self._had_task_run = data.get('_had_task_run', False)
|
||||
self._completed = data.get('_completed', False)
|
||||
self._had_task_run = data.get('_had_task_run', dict())
|
||||
self._completed = data.get('_completed', dict())
|
||||
|
||||
if include_deps:
|
||||
deps = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue