useful_scripts/vault_init.sh
Arif Ali d84ce463b1
Updates from local machine
* Add functions.sh for common tasks
* Update various scripts to use functions.sh
* Update mongo status to disable all ssh key checks
* Add a few extra scripts
2024-09-30 10:19:55 +01:00

25 lines
542 B
Bash
Executable File

#!/bin/bash
. functions.sh
check_juju_version
get_juju_status
vault_file="vault-secrets.txt"
vault_token_file="vault-token.txt"
vault operator init -key-shares=5 -key-threshold=3 > ${vault_file}
do_vault
initial_token=$(grep Initial ${vault_file} | awk '{print $4}')
export VAULT_ADDR="http://${vault_vip}:8200"
export VAULT_TOKEN=${initial_token}
vault token create -ttl=10m > ${vault_token_file}
token=$(grep token ${vault_token_file} | head -n 1 | awk '{print $2}')
${juju_run_action} vault/leader authorize-charm token=${token}