summaryrefslogtreecommitdiff
path: root/upgrade.sh
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2018-12-08 16:53:43 +0100
committerChristian Pointner <equinox@spreadspace.org>2018-12-08 16:53:43 +0100
commitee42cc8340f26be2316120a1434c5289d5927da2 (patch)
tree638ec7b167869c730fd7398a35118c330644276e /upgrade.sh
parentstrip old and not yet used hosts (diff)
improve handling of environment groups
Diffstat (limited to 'upgrade.sh')
-rwxr-xr-xupgrade.sh16
1 files changed, 10 insertions, 6 deletions
diff --git a/upgrade.sh b/upgrade.sh
index 48849b82..e44379c5 100755
--- a/upgrade.sh
+++ b/upgrade.sh
@@ -1,13 +1,17 @@
#!/bin/bash
-if [ -z "$1" ] || [ -z "$2" ]; then
- echo "$0 <environment> <host(s)>"
+if [ -z "$1" ]; then
+ echo "$0 <host(s)>"
exit 1
fi
-env="$1"
-shift
hosts="$1"
shift
-echo "######## upgrading host(s) '$hosts' in environment '$env' ########"
-exec ansible-playbook -e "myhosts=$hosts" -e "myrole=upgrade" $@ "$env/generic.yaml"
+source "${BASH_SOURCE%/*}/common/utils.sh"
+get_ansible_variable env_group "$hosts"
+if [ $? -ne 0 ]; then
+ exit 1
+fi
+
+echo "######## upgrading host(s) '$hosts' in environment '$env_group' ########"
+exec ansible-playbook -e "myhosts=$hosts" -e "myrole=upgrade" $@ "$env_group/generic.yaml"