Skip to content

Instantly share code, notes, and snippets.

View smbambling's full-sized avatar

Steven Bambling smbambling

View GitHub Profile
@smbambling
smbambling / puppetserver_irb.rb
Last active November 5, 2015 12:36
Snippet used with puppetserver irb to get info
require 'irb/completion'
require 'puppet'
Puppet.settings.preferred_run_mode = :agent # or whatever section you need
Puppet.settings.initialize_global_settings(["--config=/the/config/file"])
Puppet.settings.initialize_app_defaults(
Puppet::Settings.app_defaults_for_run_mode(Puppet.run_mode)
)
Puppet.push_context(Puppet.base_context(Puppet.settings))
require "net/http"
require "net/https"
require "uri"
require "json"
require "socket"
require "puppet"
module Puppet::Parser::Functions
newfunction(:fetch_environments, :type => :rvalue) do |args|
@smbambling
smbambling / create_groups.pp
Last active October 16, 2016 07:44
Example Puppet Class to create PE Groups automatically from Role Classes
class node_manager::create_groups {
$environments = split(fetch_environments(), ',')
$environments.each | $env | {
$classes = split(fetch_resource_types("production", "^role::"), ',')
$classes.each | $class | {
@smbambling
smbambling / fetch_resource_types.rb
Last active November 2, 2015 18:08
Puppet Function to return list (array) of resource types (classes) from the Puppet API from a supplied regex
require "net/http"
require "net/https"
require "uri"
require "json"
require "socket"
require "puppet"
module Puppet::Parser::Functions
newfunction(:fetch_resource_types, :type => :rvalue) do |args|
@smbambling
smbambling / change-idrac-password.rst
Last active October 27, 2023 08:56 — forked from andrewspiers/change-idrac-password.rst
Change iDRAC password using OpenManage

How to change an iDRAC password using Racadm for a Dell R720 and similar servers.

TLDR:

#  racadm config -g cfgUserAdmin -o cfgUserAdminPassword -i 2 <newpassword>

This guide assumes you have OpenManage installed. It was tested with the following version of OpenManage:

@smbambling
smbambling / exists.rb
Last active August 29, 2015 14:25 — forked from j4m3s/exists.rb
#
# exists.rb
#
# James Fellows 8/8/12: cloned from git://gist.github.com/1160472.git then
# modified to resolve puppet:/// paths
#
# Copyright 2011 Puppet Labs Inc.
# Copyright 2011 Krzysztof Wilczynski
#
# Licensed under the Apache License, Version 2.0 (the "License");
@smbambling
smbambling / gist:a4b26986d46cd7bac1e5
Created March 27, 2015 11:08
Sort files by human readable size
du -sk * | sort -rn | awk '{print $2}' | xargs -ia du -hs "a"