# Parsing ansible results

**URL:** <https://forum.ansible.com/t/parsing-ansible-results/12109>\
**Category:** Ansible Project\
**Tags:** windows, ansible-project\
**Created:** [November 28, 2012, 3:15pm UTC](https://forum.ansible.com/t/parsing-ansible-results/12109 "2012-11-28T15:15:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [November 28, 2012, 3:15pm UTC](https://forum.ansible.com/t/parsing-ansible-results/12109/1 "2012-11-28T15:15:10Z")

</div>

> Hi,
> 
> I'm discovering Ansible for some weeks now and I still missunderstand  
> something so, here I am 🙂  
> Security team an I are administrating about 1500 servers running different  
> OS (debian essentially, redhat, CentOS, Windows, and some other OS) and we  
> are evaluating your (amazing) tool to see if it fits our needs.
> 
> The context of this topic is the following:  
> We already have a CMDB containing the whole list of servers that we manage

This sounds like you want to write an inventory plugin. This will  
allow you to source inventory from your other database.

> and we want to execute some actions (via "playbooks" and "modules" features)

> on each server. Until this, there is no problem.  
> Once playbooks ran correctly, we have to process the results to transform it  
> into JSON output.

For storing somewhere else? This sounds like you may want to write a  
callback plugin.  
There are some examples in the checkout under 'plugins', including a  
logging one and one that makes sound effects under OS X... in any  
event, the mechanism is generic.

> Then my question is where the parsing task (which transform the result of  
> the command we ran into JSON) is executed? After reading online ansible  
> documentations, I still don't really understand if the parsing is done by  
> every server or if it is only done by the ansible server.

This part I don't quite follow. Ansible doesn't have a server, it's  
intentionally serverless. It does execute commands on remote  
machines by transferring modules that are really tiny programs, and  
those return JSON, and are parsed by /usr/bin/ansible or  
/usr/bin/ansible-playbook.

If you want to process the results of a playbook programatically, your  
two options are

(1) write a callback plugin  
(2) use the playbook API instead, deriving a program from  
/usr/bin/ansible-playbook

Hope this helps!
