Skip to content

Instantly share code, notes, and snippets.

View smbambling's full-sized avatar

Steven Bambling smbambling

View GitHub Profile
#!/usr/bin/env python
# This git-hook triggers the Code-Manager per branch and checks for status to be returned
# Requirements: This requires the python request module ( sudo yum install python-requests )
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
import json
import sys
@smbambling
smbambling / pe_filesync_client_status.rb
Last active May 17, 2016 15:35
Verify that Puppet Enterprise FileSync clients have updated environments and are on the same GIT commit hash as the Master of Masters
#!/opt/puppetlabs/puppet/bin/ruby
require "rest-client"
require "json"
require "rugged"
require 'optparse'
options = { :verbose => nil, :pretty => nil }
parser = OptionParser.new do|opts|
opts.banner = "Usage: #{$0} [options]"
@smbambling
smbambling / Git to Stash Mirror
Created March 18, 2016 12:43 — forked from skl/Git to Stash Mirror
Mirror public git repositories to an Atlassian Stash instance
#!/bin/bash
set -e
function stash_create_repo()
{
local username="$1"
local password="$2"
local hostname="$3"
local port="$4"
local project="$5"
#!/usr/bin/env bash
node_fqdn=$(hostname -f)
prettyjson='python -m json.tool'
# Generate Token for code-deployer RBAC user (5y Lifetime)
token_file_loc='/root/.puppetlabs/code-deployer_token'
# Trigger Code-Manager Deployment of ALL environments
function trigger_run() {
@smbambling
smbambling / cmd_exists.sh
Created February 11, 2016 13:43
Check if a command called in a script exists.
# Reference Commands
cmd_list='usermod groupmod find chgrp getent id awk tr wc'
# Function to check if referenced command exists
cmd_exists() {
if [ $# -eq 0 ]; then
echo 'WARNING: No command argument was passed to verify exists'
fi
cmd=${1}
@smbambling
smbambling / change_user_uid_gid.sh
Created February 11, 2016 12:48
Change User/Primary Group UID and GID
#!/usr/bin/env bash
usage() {
cat <<-EOF
usage: ${0} -l <login> -u <new uid> [-g <new gid>]
-h this help screen
-l login account login account name
-p primary group for account login
-u uid new UID to assign to account
-g new GID to assign to account group
@smbambling
smbambling / available_ips.sh
Created February 5, 2016 13:59
Find available IP addresses using DNS and DIG ( -x axfr )
#!/usr/bin/env bash
# Find available IP addresses from by using dig -x axfr
usage() {
cat <<-EOF
usage: ${0} <network>
example: ${0} 10.1.10
EOF
}
@smbambling
smbambling / .vimrc
Created November 24, 2015 19:33
Bambling .vimrc
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible " be iMproved, required
filetype off " required
" ================ General Config ====================
set number "Line numbers are good
set backspace=indent,eol,start "Allow backspace in insert mode
set history=1000 "Store lots of :cmdline history
$managed_groups = hiera_array(managed_groups)
notice ( $managed_groups )
$managed_groups.each | $group | {
$g = hiera_hash(accounts::groups).filter | $key, $val | { $key == $group }
create_resources('group', $g)
}
$managed_users = hiera_array(managed_users)
@smbambling
smbambling / pe_classifier_group.pp
Last active November 11, 2015 14:11
Puppet Class to auto create PE Classifier Environment groups based on PuppetServer environments
## This class requires env_utils, node_manager and stdlib
# Array of PE Environment Groups excluding the default 'Agent-specified environment' group
$pe_environment_groups = delete(node_groups().filter |$key, $val| { $val["environment_trumps"] == true }.map |$key, $val| { $val["name"] }, 'Agent-specified environment')
# Obtain PuppetServer environments and munge to look like PE Classifier environment Groups
$puppet_environments = regsubst(capitalize(environments()), '$', ' environment', 'G')
# Array of PE Environment Groups that should be removed based
# the PuppetServer environment no longer exists