2019-09-17 15:52:21 +03:00
|
|
|
#!/bin/bash
|
2020-05-06 12:17:29 +03:00
|
|
|
set -e
|
2019-09-17 15:52:21 +03:00
|
|
|
fqdn=$1
|
|
|
|
admin_user=$2
|
|
|
|
password=$3
|
2020-06-25 13:04:29 +03:00
|
|
|
cc_version=${4-7}
|
2019-09-17 15:52:21 +03:00
|
|
|
|
2020-06-25 13:44:10 +03:00
|
|
|
install_cli7()
|
|
|
|
{
|
|
|
|
echo "Installing CC CLI 7"
|
|
|
|
echo "Getting CLI binaries..."
|
2020-11-17 19:23:30 +03:00
|
|
|
wget -q --no-check-certificate https://$fqdn/download/tools/cyclecloud-cli.zip
|
2020-06-25 13:44:10 +03:00
|
|
|
unzip -o cyclecloud-cli.zip
|
|
|
|
pushd cyclecloud-cli-installer/
|
|
|
|
|
|
|
|
echo "Installing CLI..."
|
|
|
|
./install.sh -y
|
|
|
|
echo "Initializing CLI..."
|
|
|
|
name=$(echo $fqdn | cut -d'.' -f1)
|
|
|
|
echo $name
|
|
|
|
~/bin/cyclecloud initialize --force --batch \
|
|
|
|
--name $name \
|
|
|
|
--url=https://$fqdn \
|
|
|
|
--verify-ssl=false \
|
|
|
|
--username=$admin_user \
|
|
|
|
--password="${password}"
|
|
|
|
|
|
|
|
~/bin/cyclecloud --version
|
|
|
|
~/bin/cyclecloud config list
|
|
|
|
popd
|
|
|
|
rm cyclecloud-cli.zip
|
|
|
|
rm -rf cyclecloud-cli-installer
|
|
|
|
}
|
|
|
|
|
|
|
|
install_cli8()
|
|
|
|
{
|
2020-06-25 14:38:10 +03:00
|
|
|
echo "Installing CC CLI 8"
|
2020-06-25 13:44:10 +03:00
|
|
|
echo "Getting CLI binaries..."
|
2020-11-17 19:23:30 +03:00
|
|
|
wget -q --no-check-certificate https://$fqdn/static/tools/cyclecloud-cli.zip
|
2020-06-25 13:44:10 +03:00
|
|
|
unzip -o cyclecloud-cli.zip
|
|
|
|
pushd cyclecloud-cli-installer/
|
|
|
|
|
|
|
|
echo "Installing CLI..."
|
|
|
|
# If az CLI is installed used the bundled version
|
|
|
|
python_path=$(az --version | grep 'Python location' | xargs | cut -d' ' -f3)
|
|
|
|
if [ -n "$python_path" ]; then
|
|
|
|
$python_path install.py -y
|
|
|
|
else
|
|
|
|
if ! rpm -q python3; then
|
|
|
|
sudo yum install -y python3
|
|
|
|
fi
|
|
|
|
./install.sh -y
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Initializing CLI..."
|
|
|
|
name=$(echo $fqdn | cut -d'.' -f1)
|
|
|
|
echo $name
|
|
|
|
~/bin/cyclecloud initialize --force --batch \
|
|
|
|
--name $name \
|
2020-11-17 19:23:30 +03:00
|
|
|
--url=https://$fqdn \
|
2020-06-25 13:44:10 +03:00
|
|
|
--verify-ssl=false \
|
|
|
|
--username=$admin_user \
|
|
|
|
--password="${password}"
|
|
|
|
|
|
|
|
~/bin/cyclecloud --version
|
|
|
|
~/bin/cyclecloud config list
|
|
|
|
popd
|
|
|
|
rm cyclecloud-cli.zip
|
|
|
|
rm -rf cyclecloud-cli-installer
|
|
|
|
}
|
|
|
|
|
2019-09-17 15:52:21 +03:00
|
|
|
# Installing CycleCloud CLI
|
|
|
|
echo "Getting CLI binaries..."
|
2020-06-25 13:04:29 +03:00
|
|
|
case "$cc_version" in
|
|
|
|
7)
|
2020-06-25 13:44:10 +03:00
|
|
|
install_cli7
|
2020-06-25 13:04:29 +03:00
|
|
|
;;
|
|
|
|
8)
|
2020-06-25 13:44:10 +03:00
|
|
|
install_cli8
|
2020-06-25 13:04:29 +03:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Version $cc_version not supported"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2019-09-17 15:52:21 +03:00
|
|
|
|