freeleaps-ops/cluster/ansible/upgrade-cluster.sh
zhenyus b8675f081f fix: command error when upgrade cluster
Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-02-18 13:55:16 +08:00

23 lines
614 B
Bash
Executable File

#!/usr/bin/env bash
set -eu -o pipefail
# Check if `init.sh` has not run
if [ ! -d venv ]; then
echo "Please run init.sh first."
exit 1
fi
# Check if kubespray has not been cloned and its empty
if [ ! -d ../../3rd/kubespray ]; then
echo "Please run 'git submoudle --init --recursive' first."
exit 1
fi
# Check if `inventory.ini` has not been created
if [ ! -f ../../cluster/ansible/manifests/inventory.ini ]; then
echo "Please create your own inventory.ini first."
exit 1
fi
cd ../../3rd/kubespray && ansible-playbook -i ../../cluster/ansible/manifests/inventory.ini ./scale.yml -kK -b