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.
$ export ANSIBLE_LOAD_CALLBACK_PLUGINS=true
$ export ANSIBLE_STDOUT_CALLBACK=json
$ ansible -i hosts jenkins-master-01.local.netconomy.net \
-m setup
Do you want to give me feedback about this article in private? Please send it to comments@zerokspot.com.
Alternatively, this website also supports Webmentions. If you write a post on a blog that supports this technique, I should get notified about your link π