Created
February 21, 2015 00:06
-
-
Save sgargan/e164565bf82dc9ddb2eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Task: | |
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 = Task(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) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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