Skip to content

Instantly share code, notes, and snippets.

@paulmey
Last active March 28, 2017 22:44
Show Gist options
  • Save paulmey/3055fa5746cdd269e4f41a2540bc0223 to your computer and use it in GitHub Desktop.
Save paulmey/3055fa5746cdd269e4f41a2540bc0223 to your computer and use it in GitHub Desktop.
#!/bin/bash -ex
images="OpenLogic:CentOS:6.8
OpenLogic:CentOS:7.3
credativ:Debian:7
credativ:Debian:8
RedHat:RHEL:6.8
RedHat:RHEL:7.3
SUSE:SLES:11-SP4
SUSE:SLES:12-SP2
SUSE:openSUSE-Leap:42.2
Canonical:UbuntuServer:12.04.5-LTS
Canonical:UbuntuServer:14.04.5-LTS
Canonical:UbuntuServer:16.04-LTS
CoreOS:CoreOS:Stable
Oracle:Oracle-Linux:6.8
Oracle:Oracle-Linux:7.3"
echo "Deploying VM's of size ${vmsize:=Standard_DS1_v2} in region ${region:=westus2} in ${rgname:="$USER-endorsed-distros"}"
if az group show --name $rgname 1>&2 >/dev/null; then
echo Resource group $rgname exists, recreate?
select remove in Yes No; do
if [ $remove == "Yes" ]; then
az group delete --name $rgname --yes
break
fi
skipcreate='yes'
break
done
fi
if [ -z "$skipcreate" ]; then
az group create --name $rgname --location $region
fi
for i in $images; do
vmname=$(cut -d: -f2- <<<$i|tr ':._' '---')
echo Creating $vmname for image $i
az vm create --name "$vmname" --resource-group "$rgname" --location "$region" \
--size $vmsize --image $i:latest > "vminfo.$vmname.json" &
done
echo "Waiting for VMs to get created"
wait
echo "done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment