Show -> localhost for local_action tasks

pull/12696/head
James Cammarata 9 years ago
parent f415d39dfd
commit 770032648a

@ -64,14 +64,22 @@ class CallbackModule(CallbackBase):
msg = 'included: %s for %s' % (result._task.args.get('_raw_params'), result._host.name) msg = 'included: %s for %s' % (result._task.args.get('_raw_params'), result._host.name)
color = 'cyan' color = 'cyan'
elif result._result.get('changed', False): elif result._result.get('changed', False):
if result._task.delegate_to is not None: if result._task.delegate_to is not None or result._task._local_action:
msg = "changed: [%s -> %s]" % (result._host.get_name(), result._task.delegate_to) if result._task._local_action:
target = 'localhost'
else:
target = result._task.delegate_to
msg = "changed: [%s -> %s]" % (result._host.get_name(), target)
else: else:
msg = "changed: [%s]" % result._host.get_name() msg = "changed: [%s]" % result._host.get_name()
color = 'yellow' color = 'yellow'
else: else:
if result._task.delegate_to is not None: if result._task.delegate_to is not None or result._task._local_action:
msg = "ok: [%s -> %s]" % (result._host.get_name(), result._task.delegate_to) if result._task._local_action:
target = 'localhost'
else:
target = result._task.delegate_to
msg = "ok: [%s -> %s]" % (result._host.get_name(), target)
else: else:
msg = "ok: [%s]" % result._host.get_name() msg = "ok: [%s]" % result._host.get_name()
color = 'green' color = 'green'
@ -97,8 +105,12 @@ class CallbackModule(CallbackBase):
self._display.display(msg, color='cyan') self._display.display(msg, color='cyan')
def v2_runner_on_unreachable(self, result): def v2_runner_on_unreachable(self, result):
if result._task.delegate_to: if result._task.delegate_to or result._task._local_action:
self._display.display("fatal: [%s -> %s]: UNREACHABLE! => %s" % (result._host.get_name(), result._task.delegate_to, self._dump_results(result._result)), color='red') if result._task._local_action:
target = 'localhost'
else:
target = result._task.delegate_to
self._display.display("fatal: [%s -> %s]: UNREACHABLE! => %s" % (result._host.get_name(), target, self._dump_results(result._result)), color='red')
else: else:
self._display.display("fatal: [%s]: UNREACHABLE! => %s" % (result._host.get_name(), self._dump_results(result._result)), color='red') self._display.display("fatal: [%s]: UNREACHABLE! => %s" % (result._host.get_name(), self._dump_results(result._result)), color='red')

Loading…
Cancel
Save