1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Adding a v2 callback for task includes

This commit is contained in:
James Cammarata 2015-10-19 13:40:25 -04:00
parent dc33d30c6d
commit 1cfd941179
2 changed files with 13 additions and 6 deletions

View file

@ -292,3 +292,7 @@ class CallbackBase:
def v2_playbook_on_item_skipped(self, result):
pass # no v1
def v2_playbook_on_include(self, included_file):
pass #no v1 correspondance

View file

@ -61,8 +61,7 @@ class CallbackModule(CallbackBase):
def v2_runner_on_ok(self, result):
if result._task.action == 'include':
msg = 'included: %s for %s' % (result._task.args.get('_raw_params'), result._host.name)
color = 'cyan'
return
elif result._result.get('changed', False):
if result._task.delegate_to is not None or result._task._local_action:
if result._task._local_action:
@ -88,7 +87,7 @@ class CallbackModule(CallbackBase):
self._process_items(result)
else:
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and not '_ansible_verbose_override' in result._result and result._task.action != 'include':
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and not '_ansible_verbose_override' in result._result:
msg += " => %s" % (self._dump_results(result._result),)
self._display.display(msg, color=color)
@ -149,8 +148,7 @@ class CallbackModule(CallbackBase):
def v2_playbook_item_on_ok(self, result):
if result._task.action == 'include':
msg = 'included: %s for %s' % (result._task.args.get('_raw_params'), result._host.name)
color = 'cyan'
return
elif result._result.get('changed', False):
msg = "changed: [%s]" % result._host.get_name()
color = 'yellow'
@ -160,7 +158,7 @@ class CallbackModule(CallbackBase):
msg += " => (item=%s)" % (result._result['item'],)
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and not '_ansible_verbose_override' in result._result and result._task.action != 'include':
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and not '_ansible_verbose_override' in result._result:
msg += " => %s" % self._dump_results(result._result)
self._display.display(msg, color=color)
@ -187,3 +185,8 @@ class CallbackModule(CallbackBase):
msg += " => %s" % self._dump_results(result._result)
self._display.display(msg, color='cyan')
def v2_playbook_on_include(self, included_file):
msg = 'included: %s for %s' % (included_file._filename, ", ".join([h.name for h in included_file._hosts]))
color = 'cyan'
self._display.display(msg, color='cyan')