summaryrefslogtreecommitdiff
path: root/bin/rotate-vault-password
diff options
context:
space:
mode:
authorDmitry Ilvokhin <d@ilvokhin.com>2024-06-01 19:15:26 +0100
committerDmitry Ilvokhin <d@ilvokhin.com>2024-06-01 19:15:26 +0100
commitd129e0950bdaf55c7d752933e77790e9d5b151a3 (patch)
tree0db32866ecde3b370a239dc968d4fe87d58773f9 /bin/rotate-vault-password
parentc593b0c5ed0395c4fe31d074cfaf2e2657ae0856 (diff)
downloadinfra-d129e0950bdaf55c7d752933e77790e9d5b151a3.tar.gz
infra-d129e0950bdaf55c7d752933e77790e9d5b151a3.tar.bz2
infra-d129e0950bdaf55c7d752933e77790e9d5b151a3.zip
Remove .sh extention from bin tools
Diffstat (limited to 'bin/rotate-vault-password')
-rwxr-xr-xbin/rotate-vault-password15
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/rotate-vault-password b/bin/rotate-vault-password
new file mode 100755
index 0000000..1762786
--- /dev/null
+++ b/bin/rotate-vault-password
@@ -0,0 +1,15 @@
+#! /usr/bin/env sh
+
+head -c 128 /dev/urandom | base64 > password.txt
+
+ansible-vault rekey
+ --new-vault-password-file password.txt \
+ `git grep -l 'ANSIBLE_VAULT;1.1;AES256$'`
+
+gpg \
+ -r d@ilvokhin.com \
+ --armor \
+ --output misc/vault-password.asc \
+ --encrypt password.txt
+
+ansible-vault view misc/vaults/example.yml && rm password.txt