Skip to content

Instantly share code, notes, and snippets.

FATAL: Failed to read the private key /home/deploy/Documents/chef-repo/.chef/deploy.pem: #<Errno::ENOENT: No such file or directory - /home/deploy/Documents/chef-repo/.chef/deploy.pem>, /Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/rest/auth_credentials.rb:59:in `read'/Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/rest/auth_credentials.rb:59:in `load_signing_key'/Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/rest/auth_credentials.rb:33:in `initialize'/Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/rest.rb:48:in `new'/Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/rest.rb:48:in `initialize'/Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/role.rb:83:in `new'/Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/role.rb:83:in `chef_server_rest'/Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/role.rb:227:in `save'/Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/knife/role_from_file.rb:32:in `run'/Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/knife.rb:127:in `run'/Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/applicat
user "dbcache" do
action :create
comment "cache"
home "/home/dbcache"
supports :managed_home => true
system true
end
@cliffdickerson
cliffdickerson / gist:282007
Created January 20, 2010 17:07
chef client requirments
abstract (1.0.0)
amqp (0.6.5)
chef (0.8.0)
deep_merge (0.1.0)
erubis (2.6.5)
eventmachine (0.12.10)
extlib (0.9.13)
json (1.1.9)
mixlib-authentication (1.0.0)
mixlib-cli (1.0.4)
@cliffdickerson
cliffdickerson / shef.rb
Created January 20, 2010 17:03 — forked from danielsdeleo/shef.rb
Shef - chef in irb
$ bin/shef
Loading Node Data
Ohai2u!
chef > recipe
=> :recipe
chef:recipe > file "/tmp/foo"
=> #<Chef::Resource::File:0x1c3cd2c @provider=nil, @not_if=nil, @params={}, @recipe_name=nil, @action="create", @source_line="/Users/danielsdeleo/ruby/shef/(irb) line 2", @actions={}, @ignore_failure=false, @name="/tmp/foo", @cookbook_name=nil, @enclosing_provider=nil, @resource_name=:file, @before=nil, @supports={}, @backup=5, @allowed_actions=[:nothing, :create, :delete, :touch, :create_if_missing], @path="/tmp/foo", @only_if=nil, @noop=nil, @updated=false, @node=eigenstate.local, @collection=#<Chef::ResourceCollection:0x1c4f328 @insert_after_idx=nil, @resources=[#<Chef::Resource::File:0x1c3cd2c ...>], @resources_by_name={"file[/tmp/foo]"=>0}>>
chef:recipe > run_chef
[Tue, 03 Nov 2009 22:16:27 -0700] DEBUG: Processing file[/tmp/foo]
[Tue, 03 Nov 2009 22:16:27 -0700] DEBUG: file[/tmp/foo] using Chef::Provider::File
@cliffdickerson
cliffdickerson / build_chef_0.8
Created January 20, 2010 02:00 — forked from jasherai/build_chef_0.8
Chef .8 on ec2
# ec2 ami-1515f67c
sudo sed -i 's/universe/multiverse universe/' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert rubygems git-core rake librspec-ruby libxml-ruby thin couchdb
sudo gem sources -a http://gems.opscode.com
sudo gem sources -a http://gemcutter.org # for nanite
sudo gem install cucumber merb-core nanite jeweler uuidtools json --no-ri --no-rdoc
mkdir ~/src
cd ~/src
git clone git://github.com/opscode/chef.git
@cliffdickerson
cliffdickerson / build_chef_0.8
Created January 20, 2010 02:00 — forked from btm/build_chef_0.8
Chef .8 on ubuntu
# ec2 ami-1515f67c
sudo sed -i 's/universe/multiverse universe/' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert rubygems git-core rake librspec-ruby libxml-ruby thin couchdb zlib1g-dev libxml2-dev
sudo gem sources -a http://gems.opscode.com
sudo gem install cucumber merb-core jeweler uuidtools json libxml-ruby --no-ri --no-rdoc
mkdir ~/src
cd ~/src
git clone git://github.com/opscode/chef.git
git clone git://github.com/opscode/ohai.git
$ bin/shef
Loading Node Data
Ohai2u!
chef > recipe
=> :recipe
chef:recipe > file "/tmp/foo"
=> #<Chef::Resource::File:0x1c3cd2c @provider=nil, @not_if=nil, @params={}, @recipe_name=nil, @action="create", @source_line="/Users/danielsdeleo/ruby/shef/(irb) line 2", @actions={}, @ignore_failure=false, @name="/tmp/foo", @cookbook_name=nil, @enclosing_provider=nil, @resource_name=:file, @before=nil, @supports={}, @backup=5, @allowed_actions=[:nothing, :create, :delete, :touch, :create_if_missing], @path="/tmp/foo", @only_if=nil, @noop=nil, @updated=false, @node=eigenstate.local, @collection=#<Chef::ResourceCollection:0x1c4f328 @insert_after_idx=nil, @resources=[#<Chef::Resource::File:0x1c3cd2c ...>], @resources_by_name={"file[/tmp/foo]"=>0}>>
chef:recipe > run_chef
[Tue, 03 Nov 2009 22:16:27 -0700] DEBUG: Processing file[/tmp/foo]
[Tue, 03 Nov 2009 22:16:27 -0700] DEBUG: file[/tmp/foo] using Chef::Provider::File
# create a partition and file system for mpath14
execute "mkfs-ext3-mpath14p1" do
command "mkfs.ext3 -q /dev/mapper/mpath14p1"
action :nothing
end
execute "parted_mpath14" do
command "parted -s -- /dev/mapper/mpath14 mkpart primary ext3 0 -1"
creates "/dev/mapper/mpath14p1"
action :run
ips = {}
ips[:internal] = node[:ipaddress]
eth = node[:network][:interfaces][:eth1][:addresses]
eth.each_key do |i|
if eth[i][:family] == "inet"
ips[:external] = i
end
end
fqdns = Array.new
search(:node) do
with :fqdn, '*opscode.com'
with(:uptime).less_than Time.now
order_by :updtime, :desc
result do |n|
fqdns << n.fqdn
end
end