added task name and set fatcs to output

This commit is contained in:
dcore94 2021-02-11 15:39:52 +01:00
parent 8bee5a9f69
commit c6b4b0569b
1 changed files with 4 additions and 2 deletions

View File

@ -35,7 +35,9 @@ class ResultsCollectorJSONCallback(CallbackBase):
def v2_runner_on_ok(self, result, *args, **kwargs):
host = result._host
self.host_ok.append({ "host" :host.get_name(), "result" : result._result})
#print(dir(result._task), result._result.get("ansible_facts"))
#self.host_ok.append({ "host" :host.get_name(), "result" : result._result})
self.host_ok.append({ "host" :host.get_name(), "name" : result._task.name, "result" : { "stdout" : result._result.get("stdout"), "stderr" : result._result.get("stderr"), "ansible_facts" : result._result.get("ansible_facts") }})
def v2_runner_on_failed(self, result, *args, **kwargs):
host = result._host
@ -92,7 +94,7 @@ class Ansible(PyExecPlugin):
inventory = InventoryManager(loader=loader, sources=sources)
# variable manager takes care of merging all the different sources to give you a unified view of variables available in each context
logging.getLogger("pyexec").debug("Instiantiating VarableManager %s %s", loader, inventory)
logging.getLogger("pyexec").debug("Instiantiating VariableManager %s %s", loader, inventory)
try:
variable_manager = VariableManager(loader=loader, inventory=inventory)
except Exception as exc: