mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 06:31:23 -07:00
Make /usr/bin/ansible output realtime and also delete some code!
This commit is contained in:
parent
eb67a91c57
commit
45a455a805
4 changed files with 55 additions and 63 deletions
|
@ -83,6 +83,31 @@ class DefaultRunnerCallbacks(object):
|
|||
def on_unreachable(self, host, res):
|
||||
pass
|
||||
|
||||
class CliRunnerCallbacks(DefaultRunnerCallbacks):
|
||||
|
||||
def __init__(self):
|
||||
# set by /usr/bin/ansible later
|
||||
self.options = None
|
||||
|
||||
def on_failed(self, host, res):
|
||||
self._on_any(host,res)
|
||||
|
||||
def on_ok(self, host, res):
|
||||
self._on_any(host,res)
|
||||
|
||||
def on_unreachable(self, host, res):
|
||||
print "%s | FAILED => %s" % (host, res)
|
||||
if self.options.tree:
|
||||
utils.write_tree_file(self.options.tree, host, dict(failed=True, msg=res))
|
||||
|
||||
def on_skipped(self, host):
|
||||
pass
|
||||
|
||||
def _on_any(self, host, result):
|
||||
print utils.host_report_msg(host, self.options.module_name, result, self.options.one_line)
|
||||
if self.options.tree:
|
||||
utils.write_tree_file(self.options.tree, host, utils.bigjson(result))
|
||||
|
||||
class PlaybookRunnerCallbacks(DefaultRunnerCallbacks):
|
||||
|
||||
def __init__(self, stats):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue