Skip to content

Instantly share code, notes, and snippets.

View jtimberman's full-sized avatar
🚀

Joshua Timberman jtimberman

🚀
View GitHub Profile
#!/bin/sh
#
# EC2 bootstrap
#
mkdir /etc/chef
mkdir /var/chef
cat > /etc/chef/solo.rb <<SOLO
cookbook_path "/var/chef/cookbooks"
define :mysql_database, :action => 'create' do
def mysql(command, config=nil, )
"mysql --defaults-file=#{config} --execute=#{command.inspect}"
end
include_recipe "mysql::client"
# For now, use the super-user conf
case @node[:platform]
when "debian", "ubuntu"
#!/bin/bash
# 1st install Apple's XCode (dev tools, gcc, etc)
# Then... Setup
cat >$HOME/.bash_profile <<\THEEND
export PATH=$HOME/bin:/opt/local/bin:$PATH
export MANPATH=$HOME/man:/opt/local/man:$MANPATH
if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion
class TestCLI
include Mixlib::CLI
option :config_file,
:short => "-c CONFIG",
:long => "--config CONFIG",
:default => 'config.rb',
:description => "The configuration file to use"
option :log_level,
r = service "apache" { action :nothing }
r.updated = true
r.notifies(:start, r, :delayed)
@jtimberman
jtimberman / apt.rb
Created March 25, 2009 13:43 — forked from btm/apt.rb
#
# Cookbook Name:: apt
# Recipe:: default
#
# Copyright 2008, OpsCode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#!/usr/bin/env ruby
# -*- ruby -*-
`git checkout opscode/master`
Dir.glob("*").select {|x| FileTest.directory?(x) }.each do |path|
`git br -D #{path}`
`git checkout -b #{path} opscode/master`
`git filter-branch --tree-filter \
'rm -rf #{Dir.glob("*").reject {|x| x == path }.join(" ")}' --prune-empty HEAD`
`rm -rf .git/refs/original`
#
# nagios apache configuration
#
# Generated by Chef for <%= @node[:fqdn] %>
#
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName nagios.prod.example.com
ServerAlias nagios
define :memcached_instance, :enable => true do
runit_service "memcached-#{params[:name]}" do
template_name "memcached"
options({:max_memory => node[:memcached][:max_memory],
:port => node[:memcached][:port], :user => node[:memcached][:user],
:max_connections => node[:memcached][:port]}.merge(params))
end
service params[:name] do
#!/usr/bin/ruby
#
# Joshua Sierles, 37signals, 2009
require 'rubygems'
require 'thor'
require 'chef'
require 'chef/node'
require 'chef/rest'