Last active
March 24, 2022 08:01
-
-
Save flavono123/65522ea36a1c957c74daac0dd99c8180 to your computer and use it in GitHub Desktop.
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