Capture the output of a playbook and optionally insert it into mongodb

Hi,

So I was using the ec2 module of ansible. I was able to sucessfully create a server and with -v option, ansible showed some details to stdout.

I would like to know whether there is a way to get the output of the playbook(as JSON).

command = “ansible-playbook -v -i inventory test.yml”
test.yml

No, currently there is no way to get a pure JSON output via the CLI commands, short of executing playbooks via the API directly. If you have any interest in implementing that as a feature we would of course consider merging it in, however there has not been much of a call for something like that to date.

this could be a nice callback plugin