From 4082c6fde3601c805ddd339a89d578ca3ec9e9b5 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Sat, 4 Nov 2023 01:20:53 +0100 Subject: [PATCH] Add from_vagrant to deploy.sh --- deploy.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/deploy.sh b/deploy.sh index ee107346..429e338f 100755 --- a/deploy.sh +++ b/deploy.sh @@ -13,6 +13,7 @@ BASE_CMD="ansible-playbook playbook.yml --ask-vault-pass" if [ "$1" = "--vagrant" ]; then BASE_CMD="$BASE_CMD --verbose --inventory=vagrant_host" + VAGRANT_VAR="from_vagrant" shift fi @@ -29,17 +30,17 @@ else "services") if [ -z "$2" ]; then echo "Deploying all services!" - $BASE_CMD --tags setup_services + eval "$BASE_CMD --tags setup_services $(test -z "$VAGRANT_VAR" || printf '%s' "$VAGRANT_VAR=true")" else echo "Deploying service: $2" - $BASE_CMD --tags setup_services --extra-vars "single_service=$2" + $BASE_CMD --tags setup_services --extra-vars '{"single_service": "'"$2"'"'"$(test -z "$VAGRANT_VAR" || printf '%s' ', "'"$VAGRANT_VAR"'": true')"'}' fi ;; "base") - $BASE_CMD --tags base_only + eval "$BASE_CMD --tags base_only $(test -z "$VAGRANT_VAR" || printf '%s' "$VAGRANT_VAR=true")" ;; "users") - $BASE_CMD --tags setup-users + eval "$BASE_CMD --tags setup-users $(test -z "$VAGRANT_VAR" || printf '%s' "$VAGRANT_VAR=true")" ;; *) usage