Add from_vagrant to deploy.sh

This commit is contained in:
Sam A. 2023-11-04 01:20:53 +01:00
parent 85e1da3cbf
commit 4082c6fde3
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA

View file

@ -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