Skip to content

Instantly share code, notes, and snippets.

@lhazlewood
Created November 1, 2018 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lhazlewood/e7d09ca3a847a93dbad79570b4d22baf to your computer and use it in GitHub Desktop.
Save lhazlewood/e7d09ca3a847a93dbad79570b4d22baf to your computer and use it in GitHub Desktop.
Print an ansible fact or variable on the command line using the ansible cli and jq
# for example, to print ansible_distribution:
ansible localhost -m setup 2>/dev/null | sed '1 s/^.*$/{/' | jq -r '.ansible_facts.ansible_distribution'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment