Read vault password from bitwarden instead of filesystem

https://theorangeone.net/posts/ansible-vault-bitwarden/
This commit is contained in:
Jake Howard 2021-12-20 17:25:18 +00:00
parent b50659ab5d
commit 9e473265a5
Signed by: jake
GPG key ID: 57AFB45680EDD477
5 changed files with 6 additions and 3 deletions

1
.gitignore vendored
View file

@ -112,7 +112,6 @@ dmypy.json
# End of https://www.gitignore.io/api/python,ansible # End of https://www.gitignore.io/api/python,ansible
env/ env/
ansible/.vault_pass
ansible/galaxy_roles ansible/galaxy_roles
ansible/galaxy_collections ansible/galaxy_collections

View file

@ -15,7 +15,7 @@
### Private Settings ### Private Settings
The ansible vault password needs setting in `ansible/.vault_pass`. Ansible [integrates](https://theorangeone.net/posts/ansible-vault-bitwarden/) with Bitwarden through its [CLI](https://bitwarden.com/help/article/cli/).
Terraform configuration needs to be placed in `terraform/secrets.auto.tfvars`. Terraform configuration needs to be placed in `terraform/secrets.auto.tfvars`.

View file

@ -7,6 +7,7 @@ collections_path = $PWD/galaxy_collections
inventory = ./hosts inventory = ./hosts
become_ask_pass = True become_ask_pass = True
interpreter_python = auto interpreter_python = auto
vault_password_file = ./vault-pass.sh
[ssh_connection] [ssh_connection]
pipelining = True pipelining = True

3
ansible/vault-pass.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
bw get password infrastructure

View file

@ -4,4 +4,4 @@ set -ex
cd ansible/ cd ansible/
time ansible-playbook main.yml -K --vault-password-file .vault_pass $@ time ansible-playbook main.yml -K $@