mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-08-04 15:47:32 +02:00
Update to 2024-04-17 12:01
This commit is contained in:
20
roles/vault/templates/unseal
Normal file
20
roles/vault/templates/unseal
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
export VAULT_ADDR={{ vault_conf.api_addr }}
|
||||
|
||||
UNSEAL='{% if vault_unseal_keys | length > 0 %}{{ vault_unseal_keys | join(',') }}{% endif %}'
|
||||
STATUS=$(vault status -format json)
|
||||
|
||||
if [ "$(echo ${STATUS} | jq -r .initialized)" != "true" ]; then
|
||||
echo "Vault not initialized yet"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$(echo ${STATUS} | jq -r .sealed)" != "true" ]; then
|
||||
echo "Vault not sealed, nothing to do"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for KEY in $(echo ${UNSEAL} | sed -E 's/,/\n/g'); do
|
||||
vault operator unseal "${KEY}"
|
||||
done
|
Reference in New Issue
Block a user