Skip to content

Instantly share code, notes, and snippets.

View ned1313's full-sized avatar

Ned Bellavance ned1313

View GitHub Profile
@ned1313
ned1313 / data.tf
Created July 27, 2022 20:55
AWS Terraform Example with multiple ec2 instance and data disks
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
@ned1313
ned1313 / debug.log
Created October 9, 2019 20:38
Terraform MSI Debug Log
2019/10/09 20:36:28 [DEBUG] Starting graph walk: walkPlan
2019-10-09T20:36:28.059Z [DEBUG] plugin: starting plugin: path=/usr/local/bin/terraform args=[/usr/local/bin/terraform, internal-plugin, provisioner, local-exec]
2019-10-09T20:36:28.060Z [DEBUG] plugin: plugin started: path=/usr/local/bin/terraform pid=7907
2019-10-09T20:36:28.060Z [DEBUG] plugin: waiting for RPC address: path=/usr/local/bin/terraform
2019/10/09 20:36:28 [TRACE] dag/walk: visiting "var.vnet_cidr_range"
2019/10/09 20:36:28 [TRACE] vertex "var.vnet_cidr_range": starting visit (*terraform.NodeRootVariable)
2019/10/09 20:36:28 [TRACE] vertex "var.vnet_cidr_range": visit complete
2019/10/09 20:36:28 [TRACE] dag/walk: visiting "module.vnet-sec.var.address_space"
2019/10/09 20:36:28 [TRACE] vertex "module.vnet-sec.var.address_space": starting visit (*terraform.NodeApplyableModuleVariable)
2019/10/09 20:36:28 [TRACE] vertex "module.vnet-sec.var.address_space": evaluating
#First let's set some variables needed by the acs-engine scale command
#Values will come from the deployment log, which should be here
LOG_FILE=/var/log/azure/acsengine-kubernetes-dvm.log
ACS_ENGINE_BIN=/var/lib/waagent/custom-script/download/0/acs-engine/bin
RESOURCE_GROUP=$(grep "RESOURCE_GROUP_NAME" $LOG_FILE | awk '{print $2}')
SUBSCRIPTION_ID=$(grep "TENANT_SUBSCRIPTION_ID" $LOG_FILE | awk '{print $2}')
LOCATION=$(grep "REGION_NAME" $LOG_FILE | awk '{print $2}')
DEPLOYMENT_DIR=$(grep "Templates output directory is" $LOG_FILE | awk '{print $NF}')
NODE_POOL=$(jq -r .properties.agentPoolProfiles[0].name $DEPLOYMENT_DIR/apimodel.json)
@ned1313
ned1313 / containerscript.sh
Created February 18, 2019 20:31
Container script for Kubernetes Cluster on Azure Stack
set -e
echo "Starting deploying Kubernetes cluster"
date
echo "Running as:"
whoami
sleep 20

Keybase proof

I hereby claim:

  • I am ned1313 on github.
  • I am ned1313 (https://keybase.io/ned1313) on keybase.
  • I have a public key ASB1Bn-D7glxYeBiT0p9kS-IiNm6vrfEQwchiXnV5YDghgo

To claim this, I am signing this object:

@ned1313
ned1313 / DownloadASDK.ps1
Last active January 10, 2019 15:44
Helper Scripts for setting up the Azure Stack Development Kit
<#
This script is meant to make downloading the latest ASDK a simple affair. The files that
make up the ASDK are an executable and several bin files. This script will grab the
latest version of the ASDK from the web and then assemble the bin files into the final VHDX.
Make sure you have 40GB of free space on your C drive, or change the destination!
This does not include the process of installing the ASDK. That's a whole separate thing.
#>
#Set up the path and source URI
@ned1313
ned1313 / installAgent.sh
Last active August 30, 2018 19:34
Install the CodeDeploy agent on an EC2 instance with RHEL of Amazon Linux
#!/bin/bash
yum update -y
yum install ruby wget -y
cd /home/ec2-user
wget https://aws-codedeploy-us-east-1.s3.amazonaws.com/latest/install
chmod +x ./install
./install auto
<#
WindowsUpdatePowerShell script
Written by Ned Bellavance with functions borrowed from Brian White and the
WindowsUpdate module written by Michal Gajda. This script is meant to automate
the installation of Windows Updates on a brand new system. This is not a
replacement for WSUS or SCCM or anything centrally managed. It installs all
available, required Windows Updates until there are none left. It will
require an internet connection, of course, and local Administrator credentials.
The script is run without parameters. Logs are written out to the
@ned1313
ned1313 / Create-EC2Snapshots.ps1
Created September 26, 2016 02:25
Create-EC2Snapshots.ps1
<#
.SYNOPSIS
This script is intended to tag the volumes of an existing instance and create a snapshot for those volumes.
.DESCRIPTION
The script takes an instance ID and optional region parameter. It will find the instance in the region submitted or the
current default region and find all volumes attached to the instance. Then it will tag those volumes, and create a snapshot.
The snapshot will include the volume tags, as well as a date and name tag of its own.
.PARAMETER instanceID
Required, string, the instanceID of the instance with volumes to have snapshots taken.
.PARAMETER region
param(
[string] $ServerPrefix,
[pscredential] $credentials,
[string] $DCIpAddress
)
Write-Output "ServerPrefix: $ServerPrefix"
$names = Invoke-Command -ComputerName $DCIpAddress -ScriptBlock {param($searchString) Get-ADComputer -Filter * | Where{$_.Name -like "$($searchString)*"} | select Name} -Credential $credentials -ArgumentList $ServerPrefix
Write-Output "Names found: $names"
if($names -eq $null){$hostname = $ServerPrefix + "-01"}
else{