|
|
|
@ -95,6 +95,10 @@ class Task(Base, Conditional, Taggable, Become):
|
|
|
|
|
self._role = role
|
|
|
|
|
self._task_include = task_include
|
|
|
|
|
|
|
|
|
|
# special flag for local_action: tasks, to make sure their
|
|
|
|
|
# connection type of local isn't overridden incorrectly
|
|
|
|
|
self._local_action = False
|
|
|
|
|
|
|
|
|
|
super(Task, self).__init__()
|
|
|
|
|
|
|
|
|
|
def get_name(self):
|
|
|
|
@ -130,6 +134,16 @@ class Task(Base, Conditional, Taggable, Become):
|
|
|
|
|
t = Task(block=block, role=role, task_include=task_include)
|
|
|
|
|
return t.load_data(data, variable_manager=variable_manager, loader=loader)
|
|
|
|
|
|
|
|
|
|
def load_data(self, ds, variable_manager=None, loader=None):
|
|
|
|
|
'''
|
|
|
|
|
We override load_data for tasks so that we can pull special flags
|
|
|
|
|
out of the task args and set them internaly only so the user never
|
|
|
|
|
sees them.
|
|
|
|
|
'''
|
|
|
|
|
t = super(Task, self).load_data(ds=ds, variable_manager=variable_manager, loader=loader)
|
|
|
|
|
t._local_action = t.args.pop('_local_action', False)
|
|
|
|
|
return t
|
|
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
''' returns a human readable representation of the task '''
|
|
|
|
|
return "TASK: %s" % self.get_name()
|
|
|
|
@ -260,6 +274,7 @@ class Task(Base, Conditional, Taggable, Become):
|
|
|
|
|
|
|
|
|
|
def copy(self, exclude_block=False):
|
|
|
|
|
new_me = super(Task, self).copy()
|
|
|
|
|
new_me._local_action = self._local_action
|
|
|
|
|
|
|
|
|
|
new_me._block = None
|
|
|
|
|
if self._block and not exclude_block:
|
|
|
|
@ -277,6 +292,7 @@ class Task(Base, Conditional, Taggable, Become):
|
|
|
|
|
|
|
|
|
|
def serialize(self):
|
|
|
|
|
data = super(Task, self).serialize()
|
|
|
|
|
data['_local_action'] = self._local_action
|
|
|
|
|
|
|
|
|
|
if self._block:
|
|
|
|
|
data['block'] = self._block.serialize()
|
|
|
|
@ -295,6 +311,7 @@ class Task(Base, Conditional, Taggable, Become):
|
|
|
|
|
#from ansible.playbook.task_include import TaskInclude
|
|
|
|
|
|
|
|
|
|
block_data = data.get('block')
|
|
|
|
|
self._local_action = data.get('_local_action', False)
|
|
|
|
|
|
|
|
|
|
if block_data:
|
|
|
|
|
b = Block()
|
|
|
|
|