From ed0c16e9a173771724015226143d35c4a961f0e9 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Fri, 23 Dec 2022 18:52:33 +0100 Subject: [PATCH] Add deploy.sh (credits to data.coop/ansible) --- deploy.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 deploy.sh diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..746d665 --- /dev/null +++ b/deploy.sh @@ -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