Skip to content

Instantly share code, notes, and snippets.

# 1
execute "apt-get-update" do
command "apt-get update"
end
##############################
# 2
e = execute "apt-get-update" do
command "apt-get update"
action :run
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
amazon-ec2 (0.9.10)
amqp (0.6.7)
set daemon 30 # with start delay 30
set mailserver localhost # sudo apt-get install postfix
set mail-format { from: [email protected] }
set alert [email protected]
set logfile /var/log/monit.log
check process redis-server with pidfile /var/run/redis.pid
start program = "/usr/local/bin/redis-server /data/redis/redis.conf"
stop program = "/usr/bin/killall -9 redis-server"
if totalmem is greater than 500.0 MB for 5 cycles then alert
if cpu is greater than 80% for 5 cycles then alert
root@ip-10-204-37-155:~# chef-solo -l debug -c solo.rb -j chef.json -r http://s3.amazonaws.com/chef-solo/bootstrap-0.8.16.tar.gz
[Thu, 26 Aug 2010 19:02:27 +0000] DEBUG: Creating path /tmp/chef-solo to extract recipes into
[Thu, 26 Aug 2010 19:02:27 +0000] DEBUG: Executing tar zxvfC /tmp/chef-solo/recipes.tgz /tmp/chef-solo
[Thu, 26 Aug 2010 19:02:27 +0000] DEBUG: ---- Begin output of tar zxvfC /tmp/chef-solo/recipes.tgz /tmp/chef-solo ----
[Thu, 26 Aug 2010 19:02:27 +0000] DEBUG: STDOUT: cookbooks/apache2/
cookbooks/apache2/attributes/
cookbooks/apache2/attributes/default.rb
cookbooks/apache2/definitions/
cookbooks/apache2/definitions/apache_conf.rb
cookbooks/apache2/definitions/apache_module.rb
root@ip-10-196-203-96:~# chef-solo -l debug -c solo.rb -j chef.json -r http://s3.amazonaws.com/chef-solo/bootstrap-0.8.10.tar.gz
[Thu, 26 Aug 2010 21:22:24 +0000] DEBUG: Creating path /tmp/chef-solo to extract recipes into
[Thu, 26 Aug 2010 21:22:25 +0000] DEBUG: Executing tar zxvfC /tmp/chef-solo/recipes.tgz /tmp/chef-solo
[Thu, 26 Aug 2010 21:22:25 +0000] DEBUG: ---- Begin output of tar zxvfC /tmp/chef-solo/recipes.tgz /tmp/chef-solo ----
[Thu, 26 Aug 2010 21:22:25 +0000] DEBUG: STDOUT: cookbooks/apache2/
cookbooks/apache2/attributes/
cookbooks/apache2/attributes/apache.rb
cookbooks/apache2/definitions/
cookbooks/apache2/definitions/apache_conf.rb
root@ip-10-196-203-96:~# chef-solo -l debug -c solo.rb -j chef.json -r http://s3.amazonaws.com/chef-solo/bootstrap-0.8.10_fix_runit_lucid.tar.gz
[Thu, 26 Aug 2010 21:43:31 +0000] DEBUG: Creating path /tmp/chef-solo to extract recipes into
/usr/lib/ruby/1.8/open-uri.rb:277:in `open_http': 403 Forbidden (OpenURI::HTTPError)
from /usr/lib/ruby/1.8/open-uri.rb:616:in `buffer_open'
from /usr/lib/ruby/1.8/open-uri.rb:164:in `open_loop'
from /usr/lib/ruby/1.8/open-uri.rb:162:in `catch'
from /usr/lib/ruby/1.8/open-uri.rb:162:in `open_loop'
from /usr/lib/ruby/1.8/open-uri.rb:132:in `open_uri'
from /usr/lib/ruby/1.8/open-uri.rb:518:in `open'
root@ip-10-196-203-96:~# chef-solo -l debug -c solo.rb -j chef.json -r http://s3.amazonaws.com/chef-solo/bootstrap-0.8.10_fix_runit_lucid.tar.gz
[Thu, 26 Aug 2010 21:51:13 +0000] DEBUG: Creating path /tmp/chef-solo to extract recipes into
[Thu, 26 Aug 2010 21:51:13 +0000] DEBUG: Executing tar zxvfC /tmp/chef-solo/recipes.tgz /tmp/chef-solo
[Thu, 26 Aug 2010 21:51:14 +0000] DEBUG: ---- Begin output of tar zxvfC /tmp/chef-solo/recipes.tgz /tmp/chef-solo ----
[Thu, 26 Aug 2010 21:51:14 +0000] DEBUG: STDOUT: cookbooks/apache2/
cookbooks/apache2/attributes/
cookbooks/apache2/definitions/
cookbooks/apache2/files/
cookbooks/apache2/metadata.json
cookbooks/apache2/metadata.rb
root@ip-10-196-203-96:~# chef-solo -l debug -c solo.rb -j chef.json
[Thu, 26 Aug 2010 22:19:22 +0000] INFO: Starting Chef Solo Run
[Thu, 26 Aug 2010 22:19:22 +0000] DEBUG: Loading plugin os
[Thu, 26 Aug 2010 22:19:22 +0000] DEBUG: Loading plugin kernel
[Thu, 26 Aug 2010 22:19:22 +0000] DEBUG: Loading plugin ruby
[Thu, 26 Aug 2010 22:19:22 +0000] DEBUG: Loading plugin languages
[Thu, 26 Aug 2010 22:19:22 +0000] DEBUG: ---- Begin ruby -e "require 'rbconfig'; puts %Q(host_cpu=#{::Config::CONFIG['host_cpu']},host_vendor=#{::Config::CONFIG['host_vendor']},release_date=#{RUBY_RELEASE_DATE},bin_dir=#{::Config::CONFIG['bindir']},host=#{::Config::CONFIG['host']},target_cpu=#{::Config::CONFIG['target_cpu']},ruby_bin=#{::File.join(::Config::CONFIG['bindir'], ::Config::CONFIG['ruby_install_name'])},host_os=#{::Config::CONFIG['host_os']},target_vendor=#{::Config::CONFIG['target_vendor']},version=#{RUBY_VERSION},platform=#{RUBY_PLATFORM},target_os=#{::Config::CONFIG['target_os']},target=#{::Config::CONFIG['target']},)" ST
2010-08-26_22:33:34.25302 /usr/local/lib/site_ruby/1.8/rubygems.rb:233:in `activate': can't activate json (<= 1.4.2, runtime) for ["ohai-0.5.6", "chef-0.8.10"], already activated json-1.4.6 for ["chef-server-0.8.10"] (Gem::LoadError)
2010-08-26_22:33:34.25306 from /usr/local/lib/site_ruby/1.8/rubygems.rb:249:in `activate'
2010-08-26_22:33:34.25307 from /usr/local/lib/site_ruby/1.8/rubygems.rb:248:in `each'
2010-08-26_22:33:34.25308 from /usr/local/lib/site_ruby/1.8/rubygems.rb:248:in `activate'
2010-08-26_22:33:34.25309 from /usr/local/lib/site_ruby/1.8/rubygems.rb:249:in `activate'2010-08-26_22:33:34.25310 from /usr/local/lib/site_ruby/1.8/rubygems.rb:248:in `each'
2010-08-26_22:33:34.25311 from /usr/local/lib/site_ruby/1.8/rubygems.rb:248:in `activate'
2010-08-26_22:33:34.25311 from /usr/local/lib/site_ruby/1.8/rubygems.rb:1082:in `gem'
2010-08-26_22:33:34.25312 from /usr/lib/ruby/gems/1.8/gems/chef-server-0.8.10/bin/chef-server:39
2010-08-26_22:33:34.25312
@Aslan
Aslan / ec21.sh
Created September 16, 2010 21:26
#!/bin/bash
DEBUG=1;
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
GREP="`which grep`";