Last active
January 30, 2017 16:36
-
-
Save ceving/c673c791f90d64439ab6923875f5a97f to your computer and use it in GitHub Desktop.
Fix Ansible to talk JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
## | |
## This converts the output of the `ansible` command into valid JSON, | |
## which can be processed by `jq`. | |
## | |
echo \[ | |
sed 's/^\(.*\) | \(.*\) => {/{\n "hostname": "\1",\n "result": "\2",/' | | |
sed '$ ! s/^}/},/' | |
echo \] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment