Skip to content

Instantly share code, notes, and snippets.

View craigtracey's full-sized avatar

Craig Tracey craigtracey

View GitHub Profile
@craigtracey
craigtracey / xen_blk_facter.rb
Created January 14, 2013 18:18
Puppet fact to handle Xen device offsets
require 'facter'
def get_xen_ephemeral_device(index)
dev = Facter.value("ec2_block_device_mapping_ephemeral#{index}")
if !dev.nil?
xendev = "xvd",(dev[2] + 4).chr
if dev.length > 3
xendev = format("%s%s", xendev, dev[3, dev.length])
end
return xendev
@craigtracey
craigtracey / gist:4542893
Created January 15, 2013 22:44
Union of Chef for OpenStack attendees
import requests
import json
API_KEY = <your meetup api key here>
EVENT_IDS = [ 98235712, 99553192 ]
attendees = set()
for event_id in EVENT_IDS:
r = requests.get("https://api.meetup.com/rsvps?key=%s&sign=true&event_id=%d" % (API_KEY, event_id))
@craigtracey
craigtracey / gist:6245105
Created August 15, 2013 21:29
Preseed udev rules. Run these in a late command...especially useful when you want to bond devices.
#!/bin/bash
# this sucks, but I want my devices enumerated the way I want them
declare -A mac_devices
mac_devices["aa:bb:cc:dd:ee:f1"]="eth0"
mac_devices["aa:bb:cc:dd:ee:f2"]="eth1"
mac_devices["aa:bb:cc:dd:ee:f3"]="eth2"
mac_devices["aa:bb:cc:dd:ee:f4"]="eth3"
@craigtracey
craigtracey / gist:6941922
Created October 11, 2013 20:57
Preseed partitioning example
# Keyboard and locale
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string us
# Network
d-i netcfg/choose_interface select eth0
d-i hw-detect/load_firmware boolean true
# Mirror
@craigtracey
craigtracey / gist:6943040
Created October 11, 2013 22:32
late_command.sh for preseeding udev net rules. MACs obfuscated to protect the guilty.
# this sucks, but I think we need it.
declare -A mac_devices
mac_devices["aa:bb:cc:dd:ee:ff"]="eth0"
mac_devices["bb:cc:dd:ee:ff:aa"]="eth1"
mac_devices["cc:dd:ee:ff:aa:bb"]="eth8"
mac_devices["dd:ee:ff:aa:bb:cc"]="eth9"
UDEV_NET_RULES="/etc/udev/rules.d/70-persistent-net.rules"
echo "# This file was at least partially configured via pressed late command" > $UDEV_NET_RULES
@craigtracey
craigtracey / janky_image_builder
Last active December 31, 2015 07:09
Janky image builder
#!/bin/bash
set -e
NAME=$1
KICKSTART=$2
RPM_REPO=$3
BRIDGE="br100"
BRIDGE="virbr0"
function usage {
chef.json = {
:mysql => {
:server_debian_password => "password",
:server_root_password => "password",
:server_repl_password => "password"
},
:openstack => {
:developer_mode => true,
:memcached_servers => [],
:endpoints => {
64 bytes from 192.168.1.1: icmp_seq=17 ttl=64 time=9.00 ms
64 bytes from 192.168.1.1: icmp_seq=18 ttl=64 time=51.4 ms
64 bytes from 192.168.1.1: icmp_seq=20 ttl=64 time=8171 ms
64 bytes from 192.168.1.1: icmp_seq=21 ttl=64 time=9029 ms
64 bytes from 192.168.1.1: icmp_seq=22 ttl=64 time=8030 ms
64 bytes from 192.168.1.1: icmp_seq=23 ttl=64 time=7031 ms
64 bytes from 192.168.1.1: icmp_seq=24 ttl=64 time=6031 ms
64 bytes from 192.168.1.1: icmp_seq=25 ttl=64 time=5032 ms
64 bytes from 192.168.1.1: icmp_seq=26 ttl=64 time=4032 ms
64 bytes from 192.168.1.1: icmp_seq=27 ttl=64 time=3033 ms
#!/usr/bin/env bash
# ``stack.sh`` is an opinionated OpenStack developer installation. It
# installs and configures various combinations of **Cinder**, **Glance**,
# **Heat**, **Horizon**, **Keystone**, **Nova**, **Neutron**, and **Swift**
# This script's options can be changed by setting appropriate environment
# variables. You can configure things like which git repositories to use,
# services to enable, OS images to use, etc. Default values are located in the
# ``stackrc`` file. If you are crafty you can run the script on multiple nodes

Keybase proof

I hereby claim:

  • I am craigtracey on github.
  • I am craigtracey (https://keybase.io/craigtracey) on keybase.
  • I have a public key whose fingerprint is 3044 04DA BE1F E7D0 09B7 9C2C D8B7 ABD9 3B99 77A2

To claim this, I am signing this object: