How to get the ouput into one json file or json output

44 views
Skip to first unread message

Darup tek

unread,
Nov 9, 2014, 12:34:40 AM11/9/14
to ansible...@googlegroups.com
I am trying to gather information about some 200 servers using the setup command.
I would like to get the output as one json data. I could see 200 json outputs.
How do I get all the date into one json file with 200 servers information.

Appreciate the help.

Darup tek

unread,
Nov 9, 2014, 1:28:23 AM11/9/14
to ansible...@googlegroups.com
I managed it using the ansible.runner
Is it the right way to do it ??

J Dav

unread,
Nov 9, 2014, 12:26:59 PM11/9/14
to ansible...@googlegroups.com
Check this out https://github.com/nousdefions/ansible-tricks/tree/master/save_facts

You can see that in this example I'm also uploading the JSON to S3, but you can of course fork and tweak it for your use case. There are two variations, one that makes one giant JSON file or one to make one json file per host. 

Credit to James Martin for helping me out with this a while back.

Darup tek

unread,
Nov 10, 2014, 5:37:31 PM11/10/14
to ansible...@googlegroups.com
Thanks, I wil try.
Reply all
Reply to author
Forward
0 new messages