Add vault support
This commit is contained in:
parent
76f4e61c09
commit
a5f6e53539
16
functions
16
functions
@ -14,6 +14,7 @@ function run_playbook() {
|
|||||||
local app="$1"
|
local app="$1"
|
||||||
local play_path="$2"
|
local play_path="$2"
|
||||||
local requirements="$3"
|
local requirements="$3"
|
||||||
|
local vault_file="$DOKKU_LIB/ansible/$APP/.vault.sh"
|
||||||
|
|
||||||
validate_dependencies
|
validate_dependencies
|
||||||
|
|
||||||
@ -31,6 +32,19 @@ function run_playbook() {
|
|||||||
mkdir -p $DOKKU_ROOT/.ansible/{roles,plugins/modules}
|
mkdir -p $DOKKU_ROOT/.ansible/{roles,plugins/modules}
|
||||||
cp -R $DOKKU_ROOT/.ansible/roles/*/library/* $DOKKU_ROOT/.ansible/plugins/modules
|
cp -R $DOKKU_ROOT/.ansible/roles/*/library/* $DOKKU_ROOT/.ansible/plugins/modules
|
||||||
|
|
||||||
|
if [[ -f "$vault_file" ]]; then
|
||||||
dokku_col_log_info1_quiet "$play_path file found"
|
dokku_col_log_info1_quiet "$play_path file found"
|
||||||
ansible-playbook --inventory "$(hostname)", --connection local "$play_path"
|
dokku_col_log_info1_quiet "$vault_file file found"
|
||||||
|
ansible-playbook \
|
||||||
|
--inventory "$(hostname)", \
|
||||||
|
--connection local \
|
||||||
|
--vault-password-file "$vault_file"
|
||||||
|
"$play_path"
|
||||||
|
else
|
||||||
|
dokku_col_log_info1_quiet "$play_path file found"
|
||||||
|
ansible-playbook \
|
||||||
|
--inventory "$(hostname)", \
|
||||||
|
--connection local \
|
||||||
|
"$play_path"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,12 @@ dokku-ansible-playbook-post-extract() {
|
|||||||
dokku_col_log_info1_quiet "Checking for ansible playbooks supplied in repo"
|
dokku_col_log_info1_quiet "Checking for ansible playbooks supplied in repo"
|
||||||
if [[ -d "$TMPDIR/ansible" ]] && [[ "$(ls -A "$TMPDIR/ansible")" ]]; then
|
if [[ -d "$TMPDIR/ansible" ]] && [[ "$(ls -A "$TMPDIR/ansible")" ]]; then
|
||||||
mkdir -p "$DOKKU_LIB_ROOT/data/ansible/$APP"
|
mkdir -p "$DOKKU_LIB_ROOT/data/ansible/$APP"
|
||||||
cp -r "$TMPDIR/ansible/." "$DOKKU_LIB_ROOT/data/ansible/$APP"
|
cp -r "$TMPDIR/ansible/*.yml" "$DOKKU_LIB_ROOT/data/ansible/$APP"
|
||||||
|
if [[ -f "$TMPDIR/ansible/.vault.sh" ]]; then
|
||||||
|
dokku_col_log_info1_quiet "Moving vault password file into place"
|
||||||
|
cp -r "$TMPDIR/ansible/.vault.sh" "$DOKKU_LIB_ROOT/data/ansible/$APP"
|
||||||
|
chmod 600 "$DOKKU_LIB_ROOT/data/ansible/$APP/.vault.sh"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user