Skip to content

Instantly share code, notes, and snippets.

@subudear
subudear / master.yaml
Created April 10, 2020 21:42
kops master template
{{range $i, $id := .availability_zone_names.value}}
apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: null
labels:
kops.k8s.io/cluster: {{$.cluster_name.value}}
name: master-{{.}}
spec:
image: kope.io/k8s-1.15-debian-stretch-amd64-hvm-ebs-2020-01-17
@subudear
subudear / cluster_template.yaml
Created April 10, 2020 21:41
kops cluster yaml template for Nodes and Bastion
apiVersion: kops.k8s.io/v1alpha2
kind: Cluster
metadata:
creationTimestamp: null
name: {{.cluster_name.value}}
spec:
api:
loadBalancer:
type: Internal
authorization:
[cmdletbinding()]
Param (
[Parameter(Mandatory=$true)]
$apimServiceName,
[Parameter(Mandatory=$true)]
$resourceGroupName,
[Parameter(Mandatory=$true)]
$location,
[Parameter(Mandatory=$true)]
$organisation,
@subudear
subudear / keyvault.ps1
Created August 6, 2019 21:52
This script is to create keyvault, secret and policy access to user through powershell
#this scripts will create keyvault, assign permissions to users, apps, and groups.
#pipeline service principal App ObjectID will be assigned list,get and set permissions.
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]$location,
[Parameter(Mandatory=$true)]$resourceGroupName,
[Parameter(Mandatory=$true)]$keyVaultName,
[Parameter(Mandatory=$true)]$secretName,
# Downloads the Visual Studio Team Services Build Agent and installs on the new machine
# and registers with the Visual Studio Team Services account and build agent pool
# Enable -Verbose option
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]$VSTSAccount,
[Parameter(Mandatory=$true)]$PersonalAccessToken,
[Parameter(Mandatory=$true)]$AgentName,
[Parameter(Mandatory=$true)]$PoolName
@subudear
subudear / Installvsts.ps1
Created May 22, 2019 02:02
VSTS install script
# Downloads the Visual Studio Team Services Build Agent and installs on the new machine
# and registers with the Visual Studio Team Services account and build agent pool
# Enable -Verbose option
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]$VSTSAccount,
[Parameter(Mandatory = $true)]$PersonalAccessToken,
[Parameter(Mandatory = $true)]$AgentName,
[Parameter(Mandatory = $true)]$PoolName,
@subudear
subudear / Start_Stop_Azure_VM
Created May 14, 2019 07:47
Custom runbook to start/stop Azure VM
<#
.SYNOPSIS
Wrapper script for get all the VM's in all RG's or subscription level and then Start or Stop all valid required VMs in loop
.DESCRIPTION
This runbook is intended to start/stop VMs (ARM based VMs) that resides in a given list of Azure resource group(s).If the resource group list is empty, then the script gets all the VMs in the current subscription.
Upon completion of the runbook, an option to email results of the started VM can be sent via SendGrid account.
This runbook requires the Azure Automation Run-As (Service Principle) account, which must be added when creating the Azure Automation account.
.EXAMPLE
.\start_stop_VM.ps1 -Action "Value1" -WhatIf "False"
@subudear
subudear / ubuntu_build_agent.sh
Last active November 21, 2022 12:56
Build agent file
#!/bin/bash
set -e
export DEBIAN_FRONTEND=noninteractive
echo $1, $2, $3, $4, $5, $6
if [ ! -e $6/.configure ]; then
touch $6/.configure
fi
if [ ! -e $6/.token ]; then
touch $6/.token
@subudear
subudear / ubuntu-16.04-docker-17.12.0-ce with dotnetSDK 2.2
Last active November 21, 2022 12:57
Dockerfile to create image with vsts agent for dotnet SDK 2.2
FROM microsoft/vsts-agent:ubuntu-16.04-docker-17.12.0-ce
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs
RUN node -v
RUN apt-get update
RUN apt-get install -y wget
RUN wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.deb
@subudear
subudear / env.sh
Created March 27, 2019 21:38
export the parameters for ubuntu vsts build agent
#!/bin/bash
#Provide VSTS account name NOT the FULL URL
export VSTS_ACCOUNT=abc-example-dev
#Provide the PAT value
export VSTS_TOKEN=izpcivnfdfgdgd7gawylkjllw255yvgmoe4qtc4fxqg2mtprx4oyutretjxdpcgp5nvq
#The build agent will be ubuntu hostname appended with word agent
export VSTS_AGENT='$(hostname)-agent'
#Provide the POOL name for agent
export VSTS_POOL="Self-Hosted Linux Agent"
#provide the path where the agent will install and run, home for the agent