Use multiple vault IDs with password files
This commit is contained in:
parent
a51df26e2a
commit
8851a17a26
6 changed files with 30 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,7 @@
|
||||||
/backups/*
|
/backups/*
|
||||||
!/backups/.keep
|
!/backups/.keep
|
||||||
/playbooks/**/*.retry
|
/playbooks/**/*.retry
|
||||||
|
/secrets/*
|
||||||
|
!/secrets/.keep
|
||||||
/vendor/*
|
/vendor/*
|
||||||
!/vendor/.keep
|
!/vendor/.keep
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
[defaults]
|
[defaults]
|
||||||
ask_vault_pass = true
|
|
||||||
inventory = hosts
|
inventory = hosts
|
||||||
strategy = mitogen_linear
|
strategy = mitogen_linear
|
||||||
strategy_plugins = vendor/mitogen-0.2.8/ansible_mitogen/plugins/strategy
|
strategy_plugins = vendor/mitogen-0.2.8/ansible_mitogen/plugins/strategy
|
||||||
|
|
8
bin/ansible
Executable file
8
bin/ansible
Executable 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
8
bin/ansible-playbook
Executable 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
12
bin/extra_opts.sh
Normal 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
0
secrets/.keep
Normal file
Reference in a new issue