Skip to content

Instantly share code, notes, and snippets.

View jtimberman's full-sized avatar
🚀

Joshua Timberman jtimberman

🚀
View GitHub Profile

Easy one line Chef installation for all platforms (except windows)

curl https://www.opscode.com/chef/install.sh | sudo bash

That's it. This can be put in any instructions, such as a README or someone's blog, since the logic is in the shell script. Provided you download the script using https, the file has standard levels of authentication and encryption protecting it from manipulation.

This is obviously a shell script, if you're really concerned about the argument that it may contain nefarious activities within, you can easily review it before you run it.

@jtimberman
jtimberman / base.rb
Created March 7, 2011 17:59
an example roles/base.rb
name "base"
description "Baseline configuration for all systems."
run_list(
"recipe[ohai]",
"recipe[chef-client::delete_validation]",
"recipe[chef-client]",
"recipe[zsh]",
"recipe[git]",
"recipe[users]",
@jtimberman
jtimberman / client.rb
Created March 2, 2012 17:58 — forked from fnichol/macosx_bootstrap.sh
Mac OS X 10.7 (Lion) Bootstrapping
ssl_verify_mode :verify_peer
ssl_ca_file CA_FILE
log_level :info
log_location STDOUT
chef_server_url 'SERVER_URL'
validation_client_name 'ORGNAME-validator'
node_name 'NODE_NAME'
base_dir = "#{ENV['HOME']}/.chef"
#!/usr/bin/env ruby
recipe_path = ARGV[0]
if recipe_path.nil?
STDERR.puts "usage: chef-apply RECIPE_FILE"
exit 1
end
recipe_path = File.expand_path(recipe_path)
@jtimberman
jtimberman / command line
Created October 31, 2009 19:37 — forked from auxesis/command line
shell script testing with cucumber
bin/cucumber --require features/ features/example-script.feature
@jtimberman
jtimberman / default.rb
Created June 7, 2010 14:47
Chef version checking in recipes
# access chef's version constant directly
if Chef::VERSION.to_f >= 0.8
# 0.8+ only features here
end
# node attribute, requires ohai version 0.5.4:
if node.chef_packages.chef.version.to_f >= 0.8
# 0.8+ only features here
@jtimberman
jtimberman / gist:881058
Last active August 14, 2022 21:15
i can has ruby-1.9 package with fpm
sudo apt-get install libssl-dev
sudo gem install fpm
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.3-p392.tar.gz
tar -zxvf ruby-1.9.3-p392.tar.gz
cd src/ruby-1.9.3-p392
time (./configure --prefix=/usr && make && make install DESTDIR=/tmp/installdir)
fpm -s dir -t deb -n ruby -v 1.9.3-p392 -C /tmp/installdir \
-p ruby-VERSION_ARCH.deb -d "libstdc++6 (>= 4.4.3)" \
@jtimberman
jtimberman / chef-api-via-shef.rb
Created June 25, 2012 19:11
Work with the Chef Server API in the "main" context of "Shef" (Chef Console)
require 'chef/shef/ext'
Shef::Extensions.extend_context_object(self)
Chef::Config.from_file("/etc/chef/knife.rb")
search(:node, "role:base") # => [node[i-9c8168e5]]
@jtimberman
jtimberman / knife.rb
Created February 1, 2012 19:33
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
# Joshua Timberman <joshua@housepub.org>
# My .zshrc, modified from:
#
# $Id: .zshrc,v 1.1 2006/04/19 22:08:04 adam Exp $
#
# Adam's zshrc - <adam@stalecoffee.org>
#
# Stolen entirely from --
#
# Andy's zshrc <william.a@carrel.org>