Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kj54321/40008fc2a16fd5a9c08ced67144d6602 to your computer and use it in GitHub Desktop.
Save kj54321/40008fc2a16fd5a9c08ced67144d6602 to your computer and use it in GitHub Desktop.
ansible & jq output of facts
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
ansible "qa:&apps" -m ping
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment