From d1a76d1b81201d76a3b47cf17d504244c1cc7183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Sat, 23 Nov 2024 07:16:23 +0200 Subject: [PATCH] Get Ansible vault passwords in Infra command --- src/commands/infra.sh | 13 +++++++++++++ wx | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/commands/infra.sh b/src/commands/infra.sh index b7b07de..d041876 100644 --- a/src/commands/infra.sh +++ b/src/commands/infra.sh @@ -21,6 +21,19 @@ wx-infra(){ 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 ]] then echo "Tag Required" diff --git a/wx b/wx index c195db6..57e293f 100755 --- a/wx +++ b/wx @@ -154,6 +154,19 @@ wx-infra(){ 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 ]] then echo "Tag Required"