Skip to content

Instantly share code, notes, and snippets.

View ticean's full-sized avatar

Ticean Bennett ticean

View GitHub Profile
@ticean
ticean / ubuntu10.04-promojam.erb
Created March 9, 2012 23:34
Experimental Custom Boostrap
bash <<'EOF' || echo "Chef bootstrap failed!"
# This is a mixture of the Ironfan and @fnichol bootstraps.
# It keeps the chef ruby away from our other rubies.
#
# * installs a chef ruby using ruby_build.
# * upgrades rubygems rather than installing from source
# * pushes the node identity into the first-boot.json
# * installs the chef-client service and kicks off the first run of chef
@ticean
ticean / submodule.rb
Created January 27, 2012 09:07
Submodule cookbooks
#!/usr/bin/env ruby
# A lil' snip to submodule cookbooks in bulk.
require 'rubygems'
require 'octokit'
github_org = 'guidance-cookbooks'
Octokit.repositories(github_org).each do |repo|
unless File.exists?(File.join(File.dirname(__FILE__), "cookbooks", repo.name))
@ticean
ticean / Ticean Bennett.asc
Created January 27, 2012 06:21
Public PGP key.
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.11 (GNU/Linux)
mQMuBE6groMRCADgZsZHKVwPzl4JRhWYLbukOPS65Xn+BiMCSt0b4faFy1ieBICG
T+87F+wH0pQ69Gkq6XhO41u69uu3uHry9DSDNgkkDU9mIJtDjFgYD2rnWch5iSQo
p8/9the41uTVxKUBes9yMXa84EYrrPkn3i7bKQggJo99wA2M2sl7Ya4LtQvU5vLv
yQPsrkhpxqGu82DpyuxnJDW9aZzkoxhXhDTNIZPskNKMd1jbbBCgt/a4fIWXKQum
PRRPOzqM5nLsixR5Dx8a35cLze8o0myQdPK8iKszhLe5CTga7m47NjG91qd5XO+R
o03C64tjRIj+fS5X/LPUgRwDpqVQukWC2Qi3AQDC0gQCq251YU7s7e2Xsnv/KF2c
nPvOdHFRAzD1Vh/fuQf/XuyIe/l4ivWH9FYz/AUFZDiRUOs+GRSKKlYCusiLwqWw
@ticean
ticean / ubuntu8.04-gems.erb
Created January 12, 2012 00:35
Bootstrap Chef on Ubuntu 8.04
bash -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
if [ ! -f /usr/bin/chef-client ]; then
apt-get update
apt-get install -y ruby ruby1.8-dev build-essential wget libruby-extras libruby1.8-extras
cd /tmp
wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %>http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
tar zxf rubygems-1.3.7.tgz
cd rubygems-1.3.7
@ticean
ticean / SVN_Git_Mirror.md
Created January 3, 2012 21:14
SVN Git Mirror

Create Git Mirror from SVN Repository

This guide will demonstrate how to mirror an SVN into a Git repo. You're the target audience if you're an SVN user, just getting started with Git and need to coax your project team over to Git.

The branching scenario has been simplified for clarity.

References

@ticean
ticean / README.md
Created December 28, 2011 23:57 — forked from fnichol/README.md
Vagrantify: Create a chef-solo enabled Vagrant virtual machine for development

Installation

gem install thor
mkdir -p ~/vagrants && cd ~/vagrants
curl -LO https://raw.github.com/gist/1528832/vagrantify
chmod 755 vagrantify

Usage

./vagrantify init webserver

@ticean
ticean / recipe.rb
Created December 16, 2011 09:26 — forked from casualjim/recipe.rb
S3 File Resource for Chef
# Source accepts the protocol region:// with the host as the bucket
# access_key_id and secret_access_key are just that
# for the eu-west-1 region:
s3_file "/var/bulk/the_file.tar.gz" do
source "s3-eu-west-1://your.bucket/the_file.tar.gz"
access_key_id your_key
secret_access_key your_secret
owner "root"
group "root"
@ticean
ticean / update_dns.rake
Created December 2, 2011 22:33 — forked from mpasternacki/update_dns.rake
Rake task to update Amazon Route53 DNS from by Chef node search
# -*- ruby -*-
# Needs following parameters configured in rake.rb:
# DNS_DOMAIN: domain for which to set entries, including trailing dot
# (e.g. "example.com.")
# DNS_ATTRIBUTE: attribute containing hostname to CNAME to, defaults
# to 'fqdn'; for EC2, use "ec2.public_hostname"
# DNS_ENTRIES: hash mapping hostname to node search query,
# e.g. {'buildbot' => 'recipes:buildbot', 'monitoring' =>
# 'roles:monitoring'}
@ticean
ticean / MungeOneLine.rb
Created November 17, 2011 04:51
Chef MungeOneLine
# @see https://github.com/infochimps/cluster_chef/blob/version_3/site-cookbooks/hadoop_cluster/libraries/munge_one_line.rb
module MungeOneLine
#
# @param [String] name - name for the resource invocation
# @param [String] filename - the file to modify (in-place)
# @param [String] old_line - the string to replace
# @param [String] new_line - the string to insert in its place
# @param [String] shibboleth - a simple foolproof string that should be
# present after this works
@ticean
ticean / chef-ec2.rake
Created November 5, 2011 07:21 — forked from jtimberman/chef-ec2.rake
Chef EC2 Node Cleanup task
namespace :ec2 do
# setup chef config
# assumes this file is sibling to .chef dir, ex: CHEF_REPO/tasks
config = File.join(File.dirname(__FILE__), '..', '.chef', 'knife.rb')
Chef::Config.from_file(config)
require 'active_support'
require 'aws'
desc 'Delete any ec2-based chef nodes that no longer exist'