Skip to content

Instantly share code, notes, and snippets.

@zzondlo
zzondlo / _ubuntu-10.04-standalone.sh
Created April 7, 2012 14:49 — forked from fnichol/_ubuntu-10.04-standalone.sh
Chef bootstrap template for Ubuntu 10.04 LTS
### Ensure variables are declared
[[ -z "$RUBY_VERSION" ]] && printf ">>> RUBY_VERSION must be set.\n" && exit 10
[[ -z "$RUBY_HOME" ]] && printf ">>> RUBY_HOME must be set.\n" && exit 11
### Install Packages
set -x
@zzondlo
zzondlo / Cheffile
Created April 7, 2012 14:48 — forked from DanThiffault/Cheffile
Rails lastmile example
#!/usr/bin/env ruby
#^syntax detection
site 'http://community.opscode.com/api/v1'
cookbook 'ruby_build',
@zzondlo
zzondlo / test-my_app.json
Created April 7, 2012 14:46 — forked from ffaerber/test-my_app.json
test data-bag file for private repo on github
{
"id": "my_app",
"server_roles": [
"my_app"
],
"type": {
"my_app": [
"rails",
"unicorn"
@zzondlo
zzondlo / update_sources_list.rb
Created April 7, 2012 14:45 — forked from juanje/update_sources_list.rb
Upada sources_list data_bag
#!/usr/bin/env ruby
require 'debsfromrepos'
require 'chef/config'
require 'chef/data_bag'
Chef::Config.from_file('./.chef/knife.rb')
data_bag = 'sources_list'
#!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require 'rubygems'
require 'thor'
require 'chef'
require 'chef/node'
require 'chef/role'
require 'chef/data_bag'
@zzondlo
zzondlo / gist:2314987
Created April 5, 2012 23:22 — forked from pcn/gist:1607780
Example grover cluster definition
cluster_type = 'Grover'
differentiator = 'test'
# cluster_name = "#{cluster_type}_#{differentiator}"
cluster_name = "Grover"
require "Chef"
data = Chef::DataBagItem.load('cluster_template_values', cluster_type)['default']
ClusterChef.cluster cluster_name do
recipe "tuning"
#!/bin/bash
NODENAME="%farm_name%-%friendly_name%-%instance_id%"
LOG=/var/log/chef-bootstrap.log
DIRECTORY=/etc/chef
CLIENT_RB=$DIRECTORY/client.rb
CHEF_JSON=$DIRECTORY/chef.default.json
PRIVATE_KEY=$HOME/.ssh/id_rsa
PUBLIC_KEY=$PRIVATE_KEY.pub
function say_start {
@zzondlo
zzondlo / knife.rb
Created April 5, 2012 19:34 — forked from jtimberman/knife.rb
Commented knife.rb for all the things
# Knife Configuration File.
#
# This is a Ruby DSL to set configuration parameters for Knife's
# general options. The default location for this file is
# ~/.chef/knife.rb. If multiple Chef repositories are used,
# per-repository configuration files can be created. A per repository
# configuration file must be .chef/knife.rb in the base directory of
# the Chef repository. For example,
#
# ~/Development/chef-repo/.chef/knife.rb
require "chef/config"
require "chef/knife"
require "chef/log"
require "chef/mixin/convert_to_class_name"
module DataBagCommon
def self.included(base)
base.module_eval do
def read_secret
@zzondlo
zzondlo / gist:2297838
Created April 4, 2012 04:38 — forked from jtimberman/gist:1302749
bootstrap template that uses an encrypted data bag secret key
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.6.2.tgz
tar zxf rubygems-1.6.2.tgz
cd rubygems-1.6.2