-
-
Save boznius/ebd49607df11b8054c497ab94f30537a to your computer and use it in GitHub Desktop.
for i in $(find . -type f); do ansible-vault encrypt $i --vault-password-file ~/.vault && echo $i encrypted ; done |
Thank You. π
Here is an alternative just incase someone finds it helpful. π
find . -type f -printf "%h/\"%f\" " | xargs ansible-vault encrypt
This one works for files with spaces in their name
What about a command to vault all files named something.yml?
For instance:
group_vars > all > all.yml, password.yml
group_vars > test > test.yml, password.yml
Looking to vault all the password.yml files under those folders, and not have to do them one by one.
Find can be used to specify the name of the file as well!
Checkout here: https://stackoverflow.com/a/5905066
Doing this recursively might do the trick.
@jdotsmith What you are looking for looks like this :
for i in $(find . -name password.yml); do ansible-vault encrypt $i --vault-password-file ~/.vault && echo $i encrypted ; done
But you will need to adjust it of course.
Why not simply ansible-vault encrypt dir/* --vault-password-file ~/.vault
for all files in a folder?
Why not simply
ansible-vault encrypt dir/* --vault-password-file ~/.vault
for all files in a folder?
this doesn't work with nested dirs
Thank You. π
Here is an alternative just incase someone finds it helpful. π
find . -type f -printf "%h/\"%f\" " | xargs ansible-vault encrypt