Ansible facts as JSON

While working on our internal Jenkins setup I need to access some facts about the affected servers and post-process them somehow. While the builtin setup module generates all the output that I want, it also generated a lot of extra output that made it invalid JSON.

Turns out, Ansible has something called Stdout callbacks that allow you to register plugins which in turn post-process the whole standard output generated by Ansible.

$ ansible -i hosts \
    -m setup

Do you want to give me feedback about this article? Please send it to

Alternatively, I'm also experimenting with Webmentions. If you write a post on a blog that supports this technique, I should get notified about your link 🙂