Created
October 16, 2017 20:58
-
-
Save jrbing/4ca5469a2776e89e0d7010c44a5155fc to your computer and use it in GitHub Desktop.
Examples of using the Ansible setup module with jq
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
# List all keys | |
ansible -m setup hostname | sed '1 s/^.*$/{/' | jq '.ansible_facts | keys' | |
# Get the contents of a specific key | |
ansible -m setup hostname | sed '1 s/^.*$/{/' | jq '.ansible_facts.ansible_default_ipv4' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment