Skip to content

Instantly share code, notes, and snippets.

@sgargan
Created February 21, 2015 00:19
Show Gist options
  • Save sgargan/c0a79d8ad35d6f8647c6 to your computer and use it in GitHub Desktop.
Save sgargan/c0a79d8ad35d6f8647c6 to your computer and use it in GitHub Desktop.
class Tasky:
def __init__(self, task):
self.results = {}
def add_result(self, host, result):
self.results[host] = result
print "task (%s), results(%s) count(%s)" % (id(self), id(self.results), len(self.results))
class CallbackModule(object):
def __init__(self):
self.tasks = []
self.current = None
def playbook_on_task_start(self, name, is_conditional):
self.current = Tasky(self.task)
self.tasks.append(self.current)
def playbook_on_stats(self, stats):
for task in self.tasks:
print "task name %s" % (task.results)
def runner_on_ok(self, host, res):
if self.current:
print "task (%s)" % (id(self.current))
self.current.add_result(host, res)
- hosts: all
connection: local
tasks:
- debug: msg='stored for each host'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment