Last active
November 26, 2019 20:21
-
-
Save briantd/8fd64131ccd386064ee526ea7d358ffe to your computer and use it in GitHub Desktop.
Scripts to spin up VMs running RHEL, Centos, and Ubuntu on Azure; Setup Docker; and install REX-Ray
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo yum remove docker \ | |
docker-common \ | |
container-selinux \ | |
docker-selinux \ | |
docker-engine | |
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 | |
sudo yum-config-manager \ | |
--add-repo \ | |
https://download.docker.com/linux/centos/docker-ce.repo | |
sudo yum-config-manager --enable docker-ce-edge | |
sudo yum makecache fast | |
sudo yum install docker-ce | |
sudo systemctl start docker | |
sudo docker run hello-world | |
sudo groupadd docker | |
sudo usermod -aG docker $USER |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Abbreviated instructions from --> https://docs.docker.com/engine/installation/linux/rhel/ | |
SUB_URL="<INSERT STORE SUB URL HERE>" | |
sudo sh -c 'echo "7"> /etc/yum/vars/dockerosversion' | |
sudo sh -c 'echo "'$SUB_URL'" > /etc/yum/vars/dockerurl' | |
sudo yum install -y yum-utils | |
sudo yum-config-manager --add-repo $SUB_URL/docker-ee.repo | |
sudo yum makecache fast | |
sudo yum -y install docker-ee | |
sudo systemctl start docker | |
sudo docker run hello-world | |
sudo groupadd docker | |
sudo usermod -aG docker $USER | |
# Finally log out then back in to activate group membership | |
# | |
# (AWS only) If complaint about container-selinux: | |
# sudo yum install ftp://fr2.rpmfind.net/linux/centos/7.3.1611/extras/x86_64/Packages/container-selinux-2.9-4.el7.noarch.rpm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Abbreviated instructions from --> https://docs.docker.com/engine/installation/linux/rhel/ | |
SUB_URL=https://download.docker.com/linux/centos/ | |
sudo sh -c 'echo "7"> /etc/yum/vars/dockerosversion' | |
sudo sh -c 'echo "'$SUB_URL'" > /etc/yum/vars/dockerurl' | |
sudo yum install -y yum-utils | |
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo | |
sudo yum makecache fast | |
sudo yum -y install --enablerepo=docker-ce-test docker-ce | |
sudo systemctl start docker | |
sudo docker run hello-world | |
sudo groupadd docker | |
sudo usermod -aG docker $USER | |
# Finally log out then back in to activate group membership | |
# | |
# (AWS only) If complaint about container-selinux: | |
# sudo yum install ftp://fr2.rpmfind.net/linux/centos/7.3.1611/extras/x86_64/Packages/container-selinux-2.9-4.el7.noarch.rpm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Abbreviated instructions from --> https://docs.docker.com/engine/installation/linux/ubuntu/ | |
SUB_URL="<INSERT STORE SUB URL HERE>" | |
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual | |
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common | |
curl -fsSL $SUB_URL/gpg | sudo apt-key add - | |
sudo add-apt-repository "deb [arch=amd64] $SUB_URL $(lsb_release -cs) stable-17.06" | |
sudo apt-get update | |
sudo apt-get install docker-ee | |
sudo apt-cache madison docker-ee | |
sudo systemctl enable docker | |
sudo systemctl start docker | |
sudo docker run hello-world | |
sudo groupadd docker | |
sudo usermod -aG docker $USER | |
# Finally log out then back in to activate group membership |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Abbreviated instructions from --> https://docs.docker.com/engine/installation/linux/ubuntu/ | |
SUB_URL=https://download.docker.com/linux/ubuntu/ | |
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual | |
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo add-apt-repository "deb [arch=amd64] ${SUB_URL} $(lsb_release -cs) test" | |
sudo apt-get update | |
sudo apt-get install docker-ce --yes | |
sudo apt-cache madison docker-ce | |
sudo systemctl enable docker | |
sudo systemctl start docker | |
sudo docker run hello-world | |
sudo groupadd docker | |
sudo usermod -aG docker $USER | |
# Finally log out then back in to activate group membership |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a disk-based (non-premium/managed) storage account | |
az storage account create --name gr...ns --resource-group b...m --sku Standard_LRS | |
# Add a container | |
az storage container create --account-name gr...ns --name rexrayvolumes | |
# Get access keys | |
az storage account keys list --resource-group b...m --account-name gr...ns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash -x | |
# | |
# PRESUMES az client (Azure CLI 2.0) setup and authenticated... | |
# | |
# | |
# Resource Group -- then name for this bundle | |
# | |
RG=bd-test321 | |
az group delete --name ${RG} -y | |
az group create --name ${RG} --location southcentralus | |
# | |
# Network prefix to use when declaring custom virtual network | |
# | |
NET_PREFIX=10.0.0.0/16 | |
# Network Security Group (firewall) and rules | |
az network nsg create --resource-group ${RG} --name ${RG}-nsg | |
# Add 1 to enable ssh access from outside of Azure. This can also be accomplished via the "--nsg-rule ssh" option on "az vm create" | |
az network nsg rule create --resource-group ${RG} --nsg-name ${RG}-nsg --direction Inbound --protocol Tcp --access Allow --name default-allow-ssh --priority 100 --destination-port-range 22 | |
az network vnet create --resource-group ${RG} --name ${RG}-vn --subnet-name default --address-prefix ${NET_PREFIX} | |
az network vnet subnet create --debug --verbose --resource-group ${RG} --vnet-name ${RG}-vn --name default --network-security-group ${RG}-nsg --address-prefix ${NET_PREFIX} | |
# | |
# Virtual instances | |
# | |
# Credentials by default = the user running this script, and the user's default ssh key (e.g. id_rsa) | |
# use "--ssh-key-value "$(cat ~/.ssh/growth_azure.pub)" --admin-username bd" to change | |
az vm create --resource-group ${RG} --name ${RG}-vm1 --nsg ${RG}-nsg --vnet-name ${RG}-vn --subnet default --image RHEL --storage-sku Premium_LRS --size Standard_DS2_v2 | |
az vm create --resource-group ${RG} --name ${RG}-vm2 --nsg ${RG}-nsg --vnet-name ${RG}-vn --subnet default --image RHEL --storage-sku Premium_LRS --size Standard_DS2_v2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -sSL https://dl.bintray.com/emccode/rexray/install | INSECURE=1 sh | |
sudo apt-get install lsscsi | |
sudo vi /etc/rexray/config.yml | |
# Add this | |
rexray: | |
logLevel: debug | |
modules: | |
default-docker: | |
disabled: false | |
libstorage: | |
logging: | |
level: debug | |
httpRequests: true | |
httpResponses: true | |
server: | |
tasks: | |
exeTimeout: 120s | |
service: azureud | |
integration: | |
volume: | |
operations: | |
mount: | |
preempt: true | |
remove: | |
disable: true | |
azureud: | |
subscriptionID: d5...20 | |
resourceGroup: b...m | |
tenantID: 5f...74 | |
storageAccount: gro...ins | |
storageAccessKey: ss...Dw== | |
clientID: 01...2b | |
clientSecret: kj...wU | |
useHTTPS: true | |
container: rexrayvolumes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment