Get Ansible vault passwords in Infra command

This commit is contained in:
Christer Warén 2024-11-23 07:16:23 +02:00
parent 714feda225
commit d1a76d1b81
2 changed files with 26 additions and 0 deletions

View File

@ -21,6 +21,19 @@ wx-infra(){
fi fi
fi fi
if [[ ! -f "$INFRA_PATH/vault/cwchristerw" || ! -f "$INFRA_PATH/vault/warengroup" ]]
then
curl \
-H "X-Vault-Token: ${config["login",$ORG]}" \
-X GET \
https://$VAULT_DOMAIN/v1/cli/data/cwchristerw/settings/infra -s | jq -r '.data.data.cwchristerw' > "$INFRA_PATH/vault/cwchristerw"
curl \
-H "X-Vault-Token: ${config["login",$ORG]}" \
-X GET \
https://$VAULT_DOMAIN/v1/cli/data/cwchristerw/settings/infra -s | jq -r '.data.data.warenroup' > "$INFRA_PATH/vault/warengroup"
fi
if [[ -z $1 ]] if [[ -z $1 ]]
then then
echo "Tag Required" echo "Tag Required"

13
wx
View File

@ -154,6 +154,19 @@ wx-infra(){
fi fi
fi fi
if [[ ! -f "$INFRA_PATH/vault/cwchristerw" || ! -f "$INFRA_PATH/vault/warengroup" ]]
then
curl \
-H "X-Vault-Token: ${config["login",$ORG]}" \
-X GET \
https://$VAULT_DOMAIN/v1/cli/data/cwchristerw/settings/infra -s | jq -r '.data.data.cwchristerw' > "$INFRA_PATH/vault/cwchristerw"
curl \
-H "X-Vault-Token: ${config["login",$ORG]}" \
-X GET \
https://$VAULT_DOMAIN/v1/cli/data/cwchristerw/settings/infra -s | jq -r '.data.data.warenroup' > "$INFRA_PATH/vault/warengroup"
fi
if [[ -z $1 ]] if [[ -z $1 ]]
then then
echo "Tag Required" echo "Tag Required"