ansible/deploy.sh
Sam A. c4f3911400 Always recreate Mastodon containers (#134)
Fixes #133.

Co-authored-by: Sam Al-Sapti <sam@sapti.me>
Reviewed-on: #134
Co-authored-by: Sam A. <samsapti@noreply@git.data.coop>
Co-committed-by: Sam A. <samsapti@noreply@git.data.coop>
2022-12-04 21:45:32 +00:00

46 lines
1 KiB
Bash
Executable file

#!/bin/sh
usage () {
{
echo "Usage: $0 [--vagrant]"
echo "Usage: $0 [--vagrant] base"
echo "Usage: $0 [--vagrant] services [SERVICE]"
} >&2
}
BASE_CMD="ansible-playbook playbook.yml --ask-vault-pass"
if [ "$1" = "--vagrant" ]; then
BASE_CMD="$BASE_CMD --verbose --inventory=vagrant_host"
shift
fi
if [ -z "$(ansible-galaxy collection list community.general 2>/dev/null)" ]; then
echo "Installing community.general modules"
ansible-galaxy collection install community.general
fi
if [ -z "$1" ]; then
echo "Deploying all!"
$BASE_CMD
else
case $1 in
"services")
if [ -z "$2" ]; then
echo "Deploying all services!"
$BASE_CMD --tags setup_services
else
echo "Deploying service: $2"
$BASE_CMD --tags setup_services --extra-vars "single_service=$2"
fi
;;
"base")
$BASE_CMD --tags base_only
;;
*)
usage
exit 1
;;
esac
fi