Skip to content

Instantly share code, notes, and snippets.

View cruftyoldsysadmin's full-sized avatar

Michael T Halligan cruftyoldsysadmin

View GitHub Profile
@cruftyoldsysadmin
cruftyoldsysadmin / README.txt
Last active March 1, 2017 13:24
Debbugging the nightmare that is Puppet ERB templates
If you have ever done *anything* with Puppet templates, you know how ugly it is to debug.
This Gist will help improve debugging and reduce guesswork. The main problem I always run into when debugging
ERB templates is grokking variable access.
I have included two code snippets:
- erb-dump.pp # Puppet manifest
- erb-dump.yaml.erb # ERB template to dump the entire namespace available to the template to /tmp/erb-dump.yaml
- erb-dump.rb # loads the yaml dump into a usable ruby hash
@cruftyoldsysadmin
cruftyoldsysadmin / stackdriver-maintenance.rb
Created March 1, 2017 12:23
Ruby script to query Stackdriver for all instances currently set to Maintenance mode.
#!/usr/bin/env ruby
#
require 'net/http'
require 'json'
apiKey ='APIKEYHERE'
params = { :apikey => apiKey }
instances = {}
counter = 0