Forked from hvisage/getting jq to output ansible facts
Created
August 3, 2017 11:19
-
-
Save kj54321/40008fc2a16fd5a9c08ced67144d6602 to your computer and use it in GitHub Desktop.
ansible & jq output of facts
This file contains hidden or 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
for i in setup/*; do echo $if; jq '[.ansible_facts.ansible_hostname,.ansible_facts.ansible_devices.sda.size , .ansible_facts.ansible_all_ipv4_addresses[0]]' -c $i;done >list | |
and then, note the | @csv | |
for i in setup/*; do echo $if; jq '[.ansible_facts.ansible_hostname,.ansible_facts.ansible_devices.sda.size , .ansible_facts.ansible_all_ipv4_addresses[0]] | @csv' -r $i;done | |
"qa-pgdb01","120.00 GB","10.100.13.70" | |
for i in setup/*; do jq '[ .ansible_facts.ansible_hostname, .ansible_facts.ansible_all_ipv4_addresses[0] ] | join(", ")' -j $i;echo;done | |
qa-pgdb01, 10.100.13.70 | |
This file contains hidden or 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
ansible "qa:&apps" -m ping |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment