-
-
Save vchavkov82/14e6c7c20e5b6598f0cfbd93b088bbdf to your computer and use it in GitHub Desktop.
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 | |
export VAULT_ADDR="http://`juju run --unit vault/0 unit-get private-address`:8200" | |
VAULT_INIT="$(vault operator init -key-shares=3 -key-threshold=3)" | |
for KEY in $(echo $VAULT_INIT | grep "Unseal Key " | cut -d' ' -f4); do | |
vault operator unseal $KEY | |
done | |
export VAULT_TOKEN=$(echo $VAULT_INIT | grep "Initial Root Token: " | awk '{print $4}') | |
MY_TOKEN=$(vault token create -ttl=10m | grep "token " | awk '{print $2}') | |
juju run-action --wait vault/leader authorize-charm token=$MY_TOKEN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment