Skip to content

Instantly share code, notes, and snippets.

View tomkivlin's full-sized avatar

Tom Kivlin tomkivlin

View GitHub Profile
@tomkivlin
tomkivlin / ado-tip-deleted-svc-connection.md
Last active December 16, 2022 09:28
Azure DevOps Tip - deleted service connection

If you, like me, delete a Service Connection that was being used by a build definition and then try to edit that pipeline you may receive an error like "Cannot read properties of undefined (reading 'templatePath')".

image (8)

Rather than deleting/recreating the whole pipeline and lose the history (if that's important), you can create a new service connection and update the connectedServiceId property of the build definition via the API.

First, get the current definition:

curl -u {username}:{pat} GET https://dev.azure.com/{organization}/{project}/_apis/build/definitions/{definitionId}?api-version=7.0 | jq . > brokenbuild.json

@tomkivlin
tomkivlin / maas-cloud-init-datastore.sh
Last active February 2, 2021 16:54
Configuring disks/datastores on vSphere 6.x
#!/bin/sh
# Write all disks to a file
ls /vmfs/devices/disks/naa* > disks.txt
# Modify the file if you don't want all disks to be partitioned, etc.
sed '1,7d' disks.txt > disks_novsan.txt
# Then run through a simple loop to create a VMFS partition on each
for disk in `cat disks_novsan.txt`; do partedUtil setptbl "$disk" gpt "1 2048 3516325888 AA31E02A400F11DB9590000C2911D1B8 0"; done
@tomkivlin
tomkivlin / maas-backup.sh
Created November 30, 2020 16:18
Script for use in crontab for MaaS backups
#! /bin/bash
today=$(date +"%Y-%m-%d")
# Create snapshots for maas and maas-test-db
sudo snap save maas
sudo snap save maas-test-db
# Add the saved snapshots to an archive on the NFS server
sudo tar cvpzf /mnt/backups/maas_backup_${today}.tgz -C /var/lib/snapd/snapshots $(sudo cd /var/lib/snapd/snapshots ; sudo echo *.zip)
@tomkivlin
tomkivlin / create_esxi_maas_image.sh
Created November 19, 2020 10:51
How to create an ESXi image for MaaS
#! /bin/bash
# First confirm that the server supports HW virtualisation
grep -E -c "vmx|svm" /proc/cpuinfo
# Output should be >0. If it is 0, you need to enable VT in the BIOS.
# Then check it can run KVM VMs
sudo apt install -y cpu-checker && kvm-ok
# Needs to confirm that /dev/kvm exists and KVM acceleration can be used.
@tomkivlin
tomkivlin / Cumulus_Linux.md
Last active March 17, 2020 16:14
Installing Datadog agent on network devices

Validated on the following CL versions:

  • 3.7.2
  • 3.7.11

Installing

Use the following one-liner, substituting the actual API key.

DD_INSTALL_ONLY=true DD_AGENT_MAJOR_VERSION=7 DD_API_KEY=<get the API key from Datadog> bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)"