From 603f383b075edb0d1abe722e1c5c87bce9bf2247 Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Thu, 5 Jan 2023 05:35:24 +0000 Subject: [PATCH] Update file run_onchange_after_11-symlink-ansible-roles.tmpl --- .../run_onchange_after_11-symlink-ansible-roles.tmpl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/home/.chezmoiscripts/universal/run_onchange_after_11-symlink-ansible-roles.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_11-symlink-ansible-roles.tmpl index fd7ff664..53d46734 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_11-symlink-ansible-roles.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_11-symlink-ansible-roles.tmpl @@ -27,5 +27,15 @@ done if [ -f "$HOME/.local/src/gas-station/requirements.yml" ] && command -v ansible-galaxy > /dev/null; then logg info 'Ensuring Ansible Galaxy collections are installed' - ansible-galaxy install -r "$HOME/.local/src/gas-station/requirements.yml" + ansible-galaxy install -r "$HOME/.local/src/gas-station/requirements.yml" || EXIT_CODE=$? + if [ -n "$EXIT_CODE" ]; then + logg error 'Failed to install Ansible requirements from Ansible Galaxy' + if [ -d "$HOME/.local/src/gas-station/collections" ]; then + logg info 'Attempting to use locally stored Ansible requirements' + cd "$HOME/.local/src/gas-station/collections" + ansible-galaxy install -r requirements.yml || SECOND_EXIT_CODE=$? + if [ -n "$SECOND_EXIT_CODE" ]; then + logg error 'Failed to install requirements from both the cloud and the local copy' && exit 1 + fi + fi fi