From eeb8dc93a19f521cb6ea93a78bbeffaffb04cf2f Mon Sep 17 00:00:00 2001 From: Alex Frantz Date: Tue, 29 Jul 2025 21:50:15 -0400 Subject: [PATCH] only re-deploy caddy when tasks are defined --- scripts/deploy_containers.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/deploy_containers.sh b/scripts/deploy_containers.sh index 2f7245f..f68a9dc 100644 --- a/scripts/deploy_containers.sh +++ b/scripts/deploy_containers.sh @@ -1,14 +1,13 @@ #!/bin/bash - -echo "Redeploying Caddy.." -ansible-playbook main.yml --tags "caddy_deploy" --vault-password-file ~/.vault_pass.txt - # all new/updated tasks in the diff new_tasks=($(git diff --name-only $1 $2 | grep '\.yml$')) echo $new_tasks echo $1 $2 if [ ! -z "$new_tasks" ]; then + echo "Redeploying Caddy.." + ansible-playbook main.yml --tags "caddy_deploy" --vault-password-file ~/.vault_pass.txt + for task in "${new_tasks[@]}"; do ansible_tag=$(echo "$task" | awk -F/ '{print $2}') if [[ "$tag" != "all.yml" && "$tag" != "all.template.yml" && "$tag" != "main.yml" ]] ; then