From 5f0338815621db61e820bcbf4c34b4b0ab5bfadf Mon Sep 17 00:00:00 2001 From: vincent Date: Sun, 14 Mar 2021 20:24:53 +0100 Subject: [PATCH] add recovery vault password from bitwarden --- README.md | 2 +- ansible-vault-pass.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100755 ansible-vault-pass.sh diff --git a/README.md b/README.md index ac956d1..cf54350 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## commande ansible ***launch playbook on staging*** -`ansible-playbook -i staging site.yml --vault-password-file=.vaultpassword` +`ansible-playbook -i staging site.yml --vault-password-file=./ansible-vault-pass.sh ***init new role architecture*** `ansible-galaxy user_config init ` diff --git a/ansible-vault-pass.sh b/ansible-vault-pass.sh new file mode 100755 index 0000000..d739c2a --- /dev/null +++ b/ansible-vault-pass.sh @@ -0,0 +1,7 @@ +#!/bin/bash +BW_VAULT_ENTRY_ID="ansible vault" +if [[ -z ${BW_SESSION:-} ]] ; then + >&2 echo '$BW_SESSION not found! - You need to login to the vault' + BW_SESSION=$(bw unlock --raw) +fi +bw get password ${BW_VAULT_ENTRY_ID} --session ${BW_SESSION} --raw