From 4652e3ef355803e9abc1bc6114ada2b0c1034fbf Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Tue, 3 Feb 2026 10:17:14 +0100 Subject: [PATCH] Improve output in case of errors Before: $ ./pattern.sh make load-secrets ==> Loading secrets (this may take several minutes)... make: *** [Makefile-common:33: load-secrets] Error 2 After: ==> Loading secrets (this may take several minutes)... ==> ERROR: Secret loading failed The conditional check 'vault_ns_rc.resources | length > 0' failed. The error was: error while evaluating conditional (vault_ns_rc.resources | length > 0): 'dict object' has no attribute 'resources' You can run the following command to debug: ANSIBLE_STDOUT_CALLBACK=default EXTRA_PLAYBOOK_OPTS='-vvv -e hide_sensitive_output=false' ./pattern.sh make load-secrets Closes: #68 --- playbooks/load_secrets.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/playbooks/load_secrets.yml b/playbooks/load_secrets.yml index 49b2670..ddb05c2 100644 --- a/playbooks/load_secrets.yml +++ b/playbooks/load_secrets.yml @@ -21,6 +21,14 @@ - name: Process secrets via role ansible.builtin.include_role: name: load_secrets + rescue: + - name: "Print debugging command when secrets loading fails" + ansible.builtin.shell: | + printf "==> ERROR: Secret loading failed {{ ansible_failed_result.msg | default('Unknown error occurred') }}\n" > /dev/tty + printf "\n" > /dev/tty + printf "You can run the following command to debug:\n" > /dev/tty + printf "\n" > /dev/tty + printf " ANSIBLE_STDOUT_CALLBACK=default EXTRA_PLAYBOOK_OPTS='-vvv -e hide_sensitive_output=false' ./pattern.sh make load-secrets\n" > /dev/tty - name: Print secret loading disabled message ansible.builtin.shell: |