Skip to content

Latest commit

 

History

History
75 lines (52 loc) · 1.28 KB

azure_automation.md

File metadata and controls

75 lines (52 loc) · 1.28 KB

VM Deployment How-to

Azure

Creating VMs

In the azure cli, first define a few variables

my_group="enter the group name here"
vm_size="enter vm size here"
n_students="enter number of students here"

For the list of available sizes

az vm list-sizes --location westeurope --output table

Then create a VM scale set with public ips

az vmss create -n sgbc -g "${my_group}" --image ubuntults --public-ip-per-vm \
    --generate-ssh-keys --admin-username student --vm-sku "${vm_size}" \
	--instance-count "${n_students}"

The public IPs can be retrieved with

az vmss list-instance-public-ips --resource-group "${my_group}" --name sgbc | \
    grep "ipAddress"

Connecting

Send the private key to all students and make them do the following

mkdir -p ~/.ssh
chmod 700 ~/.ssh
mv ~/Downloads/azure_rsa ~/.ssh
chmod 600 ~/.ssh/azure_rsa

They can now connect with

ssh -i ~/.ssh/azure_rsa student@ip_address

Automate software installation

Install fabric and the azure sdk

virtualenv --python=/usr/local/bin/python2.7 fab_env
source fabric/bin/activate
pip install fabric azure

Move to the fabfiles/ dirrectory of this repo

cd fabfiles

then run

fab -l

to see available subcommands