Skip to content

Commit

Permalink
Fix path references to Ansible vault when running with Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydrogers committed Dec 18, 2024
1 parent 7989d2e commit 936dd97
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/actions/vault.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ action_vault(){
vault_run_command=("ansible-vault")
run_type="local"
else
vault_run_command=("run_ansible" "--mount-path" "$(pwd)" "ansible-vault")
vault_run_command=("run_ansible" "--mount-path" "$(pwd):/ansible" "ansible-vault")
run_type="docker"
fi

Expand Down
10 changes: 9 additions & 1 deletion lib/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,7 @@ set_ansible_vault_args() {
fi
fi

vault_args+=("--vault-password-file" ".vault-password")
vault_args+=("--vault-password-file" "/ansible/.vault-password")
elif is_encrypted_with_ansible_vault "$variable_file" || is_encrypted_with_ansible_vault ".spin-inventory.ini"; then
echo "${BOLD}${YELLOW}🔐 '.vault-password' file not found. You will be prompted to enter your vault password.${RESET}" >&2
vault_args+=("--ask-vault-pass")
Expand All @@ -1361,6 +1361,9 @@ set_ansible_vault_args() {
}

setup_color() {
# Disable debug tracing temporarily
{ set +x; } 2>/dev/null

RAINBOW="
$(printf '\033[38;5;196m')
$(printf '\033[38;5;202m')
Expand All @@ -1374,6 +1377,11 @@ setup_color() {
BOLD=$(printf '\033[1m')
RESET=$(printf '\033[m')
MAGENTA=$(printf '\033[1;35m')

# Restore debug tracing if it was enabled
if [[ "${SPIN_DEBUG:-false}" == "true" ]]; then
set -x
fi
}

show_existing_files_warning() {
Expand Down

0 comments on commit 936dd97

Please sign in to comment.