mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
playbooks -- Ratchet up logging prior to gating things with verbosity controls and upgrading output format
This commit is contained in:
parent
a5f4ca50b8
commit
e89131a3a2
1 changed files with 10 additions and 1 deletions
|
@ -84,6 +84,14 @@ class PlaybookCallbacks(object):
|
||||||
def on_dark_host(self, host, msg):
|
def on_dark_host(self, host, msg):
|
||||||
print "exception: [%s] => %s" % (host, msg)
|
print "exception: [%s] => %s" % (host, msg)
|
||||||
|
|
||||||
|
def summarize(results):
|
||||||
|
''' print out per host statistics '''
|
||||||
|
|
||||||
|
print "PLAY RECAP ******************************\n"
|
||||||
|
|
||||||
|
hosts = sorted(results.keys())
|
||||||
|
for host in hosts:
|
||||||
|
print "%s : %s" % (host, utils.smjson(results[host]))
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
''' run ansible-playbook operations '''
|
''' run ansible-playbook operations '''
|
||||||
|
@ -125,7 +133,8 @@ def main(args):
|
||||||
timeout=options.timeout
|
timeout=options.timeout
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
pb.run()
|
results = pb.run()
|
||||||
|
summarize(results)
|
||||||
except errors.AnsibleError, e:
|
except errors.AnsibleError, e:
|
||||||
print >>sys.stderr, "ERROR: %s" % e
|
print >>sys.stderr, "ERROR: %s" % e
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in a new issue