Rename shorter command and add default

This commit is contained in:
Luke Murphy 2020-03-21 23:54:25 +01:00
parent e6aa8fa4d1
commit fe3baa4eb2
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
3 changed files with 22 additions and 6 deletions

View File

@ -11,7 +11,7 @@ case "$1" in
#shellcheck disable=SC2034
declare desc="return ansible-playbook plugin help content"
cat<<help_content
ansible:add-vault-password, Insert new vault password for encrypt/decrypt of passwords
ansible:vault-pass, Insert new vault password for encrypt/decrypt of passwords
help_content
}

16
subcommands/default Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
ansible_default_cmd() {
echo -e 'Usage: dokku ansible[:COMMAND]'
echo ''
echo 'Run ansible playbooks during deployment'
echo ''
echo 'Commands:'
cat<<help_content
ansible:vault-pass, Insert new vault password for encrypt/decrypt of passwords
help_content
}
ansible_default_cmd "$@"

View File

@ -4,11 +4,11 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
ansible_add_vault_password_cmd() {
ansible_vault_pass_cmd() {
#shellcheck disable=SC2034
declare desc="insert new vault password for encrypt/decrypt of passwords"
if [[ -f "$DOKKU_LIB/data/ansible/.vault-password" ]]; then
if [[ -f "$DOKKU_LIB/data/ansible/.vault-pass" ]]; then
dokku_col_log_info1_quiet "Vault password already in place"
exit 0
fi
@ -20,9 +20,9 @@ ansible_add_vault_password_cmd() {
mkdir -p "$DOKKU_LIB/data/ansible"
fi
dokku_col_log_info1_quiet "Generating $DOKKU_LIB/data/ansible/.vault-password"
echo "$vault_password" > "$DOKKU_LIB/data/ansible/.vault-password"
dokku_col_log_info1_quiet "Generating $DOKKU_LIB/data/ansible/.vault-pass"
echo "$vault_password" > "$DOKKU_LIB/data/ansible/.vault-pass"
}
ansible_add_vault_password_cmd "$@"
ansible_vault_pass_cmd "$@"