Skip to content

Instantly share code, notes, and snippets.

@geekzter
Last active May 4, 2022 03:50
Show Gist options
  • Save geekzter/2a0d612fb2f9d804577f0c7d86313eb3 to your computer and use it in GitHub Desktop.
Save geekzter/2a0d612fb2f9d804577f0c7d86313eb3 to your computer and use it in GitHub Desktop.
Azure Pipeline Agent Cloud Config
#cloud-config
bootcmd:
- sudo apt remove unattended-upgrades -y
# Prevent race condition with VM extension provisioning
- while ( fuser /var/lib/dpkg/lock >/dev/null 2>&1 ); do sleep 5; done;
- while ( fuser /var/lib/apt/lists/lock >/dev/null 2>&1 ); do sleep 5; done;
# Get apt repository signing keys
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 # GitHub
- sudo apt-add-repository https://cli.github.com/packages
- curl https://baltocdn.com/helm/signing.asc | sudo apt-key add - # Helm
- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add # Kubernetes
- curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - # Microsoft
apt:
sources:
git-core:
source: "ppa:git-core/ppa"
helm-stable-debian.list:
source: "deb https://baltocdn.com/helm/stable/debian/ all main"
kubernetes.list:
source: "deb http://apt.kubernetes.io/ kubernetes-xenial main"
azure-cli.list:
source: "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ bionic main"
microsoft-prod.list:
source: "deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod bionic main"
package_update: true
# Disable package upgrades to get rid of the following error
# Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
# package_upgrade: true
packages:
# Core
- apt-transport-https
- ca-certificates
- curl
- gnupg
- lsb-release
- software-properties-common
# Tools
- ansible
- coreutils
- docker
- unixodbc-dev
- unzip
# Kubernetes
- helm
- kubectl
# Microsoft
- azure-cli
- azure-functions-core-tools
- dotnet-sdk-3.1
- powershell
runcmd:
# Automatic updates: re-enable them
- sudo apt install unattended-upgrades -y
write_files:
- path: /etc/environment
content: |
GEEKZTER_AGENT_SUBNET_ID="${subnet_id}"
GEEKZTER_AGENT_VIRTUAL_NETWORK_ID="${virtual_network_id}"
append: true
final_message: "Up after $UPTIME seconds"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment