Skip to content

Instantly share code, notes, and snippets.

@nirebu
Last active February 5, 2019 13:29
Show Gist options
  • Save nirebu/6010a2e0002d7c69a9ec04bc45eac095 to your computer and use it in GitHub Desktop.
Save nirebu/6010a2e0002d7c69a9ec04bc45eac095 to your computer and use it in GitHub Desktop.
Collect and transform IPv4 data via Ansible and jq
#!/bin/bash
ansible -i 'localhost,' all -m setup | sed '1c {' | jq '.ansible_facts.ansible_all_ipv4_addresses[] | { address: . }' --compact-output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment