1
0
Fork 0

Use multiple vault IDs with password files

This commit is contained in:
Alex Kotov 2020-07-05 00:28:37 +05:00
parent a51df26e2a
commit 8851a17a26
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
6 changed files with 30 additions and 1 deletions

2
.gitignore vendored
View File

@ -1,5 +1,7 @@
/backups/*
!/backups/.keep
/playbooks/**/*.retry
/secrets/*
!/secrets/.keep
/vendor/*
!/vendor/.keep

View File

@ -1,5 +1,4 @@
[defaults]
ask_vault_pass = true
inventory = hosts
strategy = mitogen_linear
strategy_plugins = vendor/mitogen-0.2.8/ansible_mitogen/plugins/strategy

8
bin/ansible Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
FILE=$(readlink -f "$0")
DIR=$(dirname "$FILE")
. "$DIR/extra_opts.sh"
exec ansible "$@" $extra_opts

8
bin/ansible-playbook Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
FILE=$(readlink -f "$0")
DIR=$(dirname "$FILE")
. "$DIR/extra_opts.sh"
exec ansible-playbook "$@" $extra_opts

12
bin/extra_opts.sh Normal file
View File

@ -0,0 +1,12 @@
for vault_id in default kotovalexarian
do
if [ -f "secrets/$vault_id" ]; then
if [ -z "$extra_opts" ]; then
extra_opts="--vault-id"
else
extra_opts="$extra_opts --vault-id"
fi
extra_opts="$extra_opts $vault_id@secrets/$vault_id"
fi
done

0
secrets/.keep Normal file
View File