Skip to content

Instantly share code, notes, and snippets.

@sumansrivastava
Created February 21, 2023 01:10
Show Gist options
  • Select an option

  • Save sumansrivastava/92376057962100e6385cfbd86c097cdd to your computer and use it in GitHub Desktop.

Select an option

Save sumansrivastava/92376057962100e6385cfbd86c097cdd to your computer and use it in GitHub Desktop.
#!/bin/bash
# Check if Azure CLI is installed
if ! command -v az &> /dev/null
then
echo "Azure CLI not found. Installing..."
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
else
echo "Azure CLI already installed."
fi
# Check if kubectl is installed
if ! command -v kubectl &> /dev/null
then
echo "kubectl not found. Installing..."
sudo apt-get update && sudo apt-get install -y apt-transport-https gnupg2
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl
else
echo "kubectl already installed."
fi
# Check if Terraform is installed
if ! command -v terraform &> /dev/null
then
echo "Terraform not found. Installing..."
wget https://releases.hashicorp.com/terraform/1.1.4/terraform_1.1.4_linux_amd64.zip
unzip terraform_1.1.4_linux_amd64.zip
sudo mv terraform /usr/local/bin/
rm terraform_1.1.4_linux_amd64.zip
else
echo "Terraform already installed."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment