Last active
September 6, 2017 10:23
-
-
Save Nani-o/09ca2e3a3490f87ba9d4257348641c5f to your computer and use it in GitHub Desktop.
bash - List all Ansible variables within a file or folder
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
| #!/bin/bash | |
| TARGET="$1" | |
| if [[ ! -e "${TARGET}" ]]; then | |
| echo "${TARGET}: no such file or directory" | |
| exit 1 | |
| fi | |
| grep --color=always -RoP "{{[A-z0-9 _-]*}}" "${TARGET}" | cut -d ':' -f2 | sort | uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment