diff --git a/Build.md b/Build.md index 3942f65..c4033d1 100644 --- a/Build.md +++ b/Build.md @@ -43,3 +43,7 @@ gcloud config set project $GOOGLE_CLOUD_PROJECT ## AWS Expect that `aws` is installed locally. A ssh-key named 'learner' is required to access the account. + +## Azure + +Expect that `az` is installed and configured locally. It will utilize your ~/.ssh/id_rsa.pub key. diff --git a/scripts/aws-create.sh b/scripts/aws-create.sh index 43e7941..a107e92 100755 --- a/scripts/aws-create.sh +++ b/scripts/aws-create.sh @@ -3,7 +3,9 @@ # Options BRANCH="${1:-aws-dev}" # checkout branch $1 -# Static Config - update aws-*.sh files +# Provider Config - update aws-*.sh files. + +# Static Config - update *.sh files NAME=learner VM=essentials PROJECT=CLASS-Essentials diff --git a/scripts/azure-create.sh b/scripts/azure-create.sh new file mode 100755 index 0000000..8d5ee42 --- /dev/null +++ b/scripts/azure-create.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +# Options +BRANCH="${1:-azure-dev}" # checkout branch $1 + +# Provider Config - update *-azure.sh files. +LOCATION=centralus + +# Static Config - update *.sh files +NAME=learner +VM=essentials +PROJECT=CLASS-Essentials +GITHUB=github.internet2.edu +REPO="git@${GITHUB}:CLASS/${PROJECT}.git" + +echo "=== azure-create.sh $PROJECT $BRANCH" +RESOURCE_GROUP=$VM + +echo "+++ creating resource group $RESOURCE_GROUP" +az group create --resource-group $RESOURCE_GROUP --location $LOCATION + +echo "+++ creating VM $VM" +# Ubuntu is "Canonical:0001-com-ubuntu-server-focal:20_04-lts:latest" +az vm create --resource-group $RESOURCE_GROUP --name $VM \ + --image Canonical:0001-com-ubuntu-server-focal:20_04-lts:latest \ + --size Standard_D4_v4 \ + --storage-sku Standard_LRS \ + --public-ip-sku Standard \ + --admin-username $NAME + +IP=$(az vm show --name essentials --resource-group essentials -d --query publicIps -otsv) + +echo "+++ wait for boot and cloud-init ${VM} ${IP}" +ssh-keygen -R $IP +while ! ssh $NAME@$IP sudo cloud-init status --wait ; do + sleep 1 +done + +echo "+++ configuring VM" +ssh -A $NAME@$VM < .ssh/known_hosts +git config --global color.ui auto +git config --global push.default simple +git config --global pull.ff only +git config --global user.name "$(git config user.name)" +git config --global user.email "$(git config user.name)" +git clone --branch $BRANCH $REPO +EOF + +echo "+++ configure ~/.ssh/$VM.config" +cat > ~/.ssh/$VM.config < .ssh/known_hosts git config --global color.ui auto git config --global push.default simple