Add deploy.sh (credits to data.coop/ansible)

This commit is contained in:
Sam A. 2022-12-23 18:52:33 +01:00
parent de054a75a5
commit ed0c16e9a1
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA

37
deploy.sh Executable file
View file

@ -0,0 +1,37 @@
#!/bin/sh
usage () {
echo "Usage: $0"
echo "Usage: $0 boot"
echo "Usage: $0 services [SINGLE_SERVICE]"
}
BASE_CMD="ansible-playbook playbook.yml --ask-vault-pass --ask-become-pass"
if [ -z "$(ansible-galaxy collection list community.general 2>/dev/null)" ]; then
ansible-galaxy collection install community.general
fi
if [ -z "$1" ]; then
$BASE_CMD
else
case $1 in
boot)
$BASE_CMD --tags boot
;;
services)
if [ -z "$2" ]; then
$BASE_CMD --tags services
else
$BASE_CMD --tags services --extra-vars "single_service=$2"
fi
;;
-h|--help)
usage
;;
*)
usage >&2
exit 1
;;
esac
fi