demo: Fix Vagrantfile when building staging VM for Cloud build.

Updates the base VM image used as well as fixes install failures
with Azure CLI and Docker.
This commit is contained in:
James Rasell 2020-06-17 12:22:24 +02:00
parent 70b00f7baa
commit 1b94305e21
No known key found for this signature in database
GPG Key ID: AA7D460F5C8377AA
1 changed files with 32 additions and 13 deletions

45
terraform/Vagrantfile vendored
View File

@ -3,7 +3,7 @@
Vagrant.configure(2) do |config| Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64" config.vm.box = "ubuntu/bionic64"
config.vm.provision "shell", inline: <<-SHELL config.vm.provision "shell", inline: <<-SHELL
cd /tmp cd /tmp
@ -14,20 +14,32 @@ Vagrant.configure(2) do |config|
TERRAFORMDOWNLOAD=https://releases.hashicorp.com/terraform/${TERRAFORMVERSION}/terraform_${TERRAFORMVERSION}_linux_amd64.zip TERRAFORMDOWNLOAD=https://releases.hashicorp.com/terraform/${TERRAFORMVERSION}/terraform_${TERRAFORMVERSION}_linux_amd64.zip
echo "Dependencies..." echo "Dependencies..."
sudo apt-get install -y unzip tree sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
gnupg-agent \
lsb-release \
software-properties-common \
unzip
# Azure CLI # Azure CLI
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ wheezy main" | sudo tee /etc/apt/sources.list.d/azure-cli.list curl -sL https://packages.microsoft.com/keys/microsoft.asc |
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 417A0893 gpg --dearmor |
sudo apt-get install apt-transport-https sudo tee /etc/apt/trusted.gpg.d/microsoft.asc.gpg > /dev/null
sudo apt-get update && sudo apt-get install azure-cli AZ_REPO=$(lsb_release -cs)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" |
sudo tee /etc/apt/sources.list.d/azure-cli.list
sudo apt-get update
sudo apt-get install azure-cli
# Disable the firewall # Disable the firewall
sudo ufw disable sudo ufw disable
## Packer ## Packer
echo Fetching Packer... echo Fetching Packer...
curl -L $PACKERDOWNLOAD > packer.zip curl -s -L $PACKERDOWNLOAD > packer.zip
echo Installing Packer... echo Installing Packer...
unzip packer.zip -d /usr/local/bin unzip packer.zip -d /usr/local/bin
chmod 0755 /usr/local/bin/packer chmod 0755 /usr/local/bin/packer
@ -35,17 +47,24 @@ Vagrant.configure(2) do |config|
## Terraform ## Terraform
echo Fetching Terraform... echo Fetching Terraform...
curl -L $TERRAFORMDOWNLOAD > terraform.zip curl -s -L $TERRAFORMDOWNLOAD > terraform.zip
echo Installing Terraform... echo Installing Terraform...
unzip terraform.zip -d /usr/local/bin unzip terraform.zip -d /usr/local/bin
chmod 0755 /usr/local/bin/terraform chmod 0755 /usr/local/bin/terraform
chown root:root /usr/local/bin/terraform chown root:root /usr/local/bin/terraform
## Docker # Download and install Docker.
echo deb https://apt.dockerproject.org/repo ubuntu-`lsb_release -c | awk '{print $2}'` main | sudo tee /etc/apt/sources.list.d/docker.list curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D add-apt-repository \
sudo apt-get update "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
sudo apt-get install -y docker-engine $(lsb_release -cs) \
stable"
apt-get update
apt-get install -y \
docker-ce \
docker-ce-cli \
containerd.io
usermod -aG docker vagrant
SHELL SHELL