Last active
March 24, 2022 08:01
Ansible Ad-hoc command outputs as 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
# module output JSON + "ansible_host" and "success" fields | |
$ <ansible_ad_hoc_command> | sed -E 's/(.*) \| FAILED\! \=> \{/\{"ansible_host": "\1", "success": false,/; | |
s/(.*) \| SUCCESS \=> \{/\{"ansible_host": "\1", "success": true,/' | jq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment