Skip to content

Instantly share code, notes, and snippets.

@botchagalupe
Created November 7, 2010 12:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save botchagalupe/666110 to your computer and use it in GitHub Desktop.
Save botchagalupe/666110 to your computer and use it in GitHub Desktop.
General Chef Notes

Chef Demo One

Prep Work

knife cookbook site vendor -d ntp

Use chef-solo to launch ntp...

Chef Demo Two

Prep Work

Clear out the cookboos directory 
knife cookbook site vendor -d apache2
knife cookbook upload apache2

##Notes

Ubuntu 10.10 Maverick EBS boot Canonical ubuntu@ 64bit ami-548c783d

knife ec2 server create "role[micros]" -f t1.micro -i ami-548c783d -G default -S botchagalupe -x ubuntu -I ~/.ssh/id_rsa -y >/tmp/web$i.out

Ubuntu 10.04 LTS Lucid EBS boot Canonical ubuntu@ 64bit ami-4a0df923

knife ec2 server create "role[webserver]" -f t1.micro -i ami-4a0df923 -G default -S botchagalupe -x ubuntu -I ~/.ssh/id_rsa  

gem install capistrano

cap default -S nodelist=$instances

cap default -S nodelist='ec2-67-202-37-167.compute-1.amazonaws.com ec2-75-101-196-114.compute-1.amazonaws.com ec2-50-16-36-116.compute-1.amazonaws.com ec2-184-73-150-7.compute-1.amazonaws.com ec2-50-16-81-101.compute-1.amazonaws.com ec2-50-16-48-242.compute-1.amazonaws.com ec2-50-16-43-203.compute-1.amazonaws.com ec2-75-101-189-118.compute-1.amazonaws.com ec2-50-16-62-73.compute-1.amazonaws.com ec2-50-16-22-83.compute-1.amazonaws.com ec2-50-16-29-64.compute-1.amazonaws.com ec2-50-16-65-12.compute-1.amazonaws.com ec2-50-16-92-241.compute-1.amazonaws.com ec2-184-73-149-128.compute-1.amazonaws.com ec2-184-72-95-36.compute-1.amazonaws.com ec2-204-236-243-183.compute-1.amazonaws.com '

more Capfile require 'tempfile'

set(:nodelist) do Capistrano::CLI.ui.ask "Node list: " end unless exists?(:nodelist)

nodelist.split.each do |node| role :nodes, node, :ssh_options => {:user => "ubuntu", :keys => "belgium.pem"} end

task :default do pwhash = "$1$xMc08XfL$b4aNqWyrFB3yg3S3oJo2m0" if ENV.has_key?("IP") ip = ENV["IP"] end #run "echo '#{ip} opsmaster' | sudo tee -a /etc/hosts" sudo "usermod -p '#{pwhash}' ubuntu" sudo "sed -i 's/^PasswordAuthentication no$/PasswordAuthentication yes/' /etc/ssh/sshd_config" sudo "/etc/init.d/ssh restart" end

sudo shef -z -c /etc/chef/client.rb

This is shef, the Chef shell. Chef Version: 0.9.12 http://www.opscode.com/chef http://wiki.opscode.com/display/chef/Home

run help' for help, exit' or ^D to quit.

Ohai2u johnwillis@John-Williss-MacBook-Pro.local! chef > recipe chef:recipe > chef:recipe > file "/tmp/class" do chef:recipe > content "Hello World" chef:recipe ?> end

chef:recipe > search(:role,":") {|r| puts r } role[webserver] role[web] role[lb] role[micros] => true chef:recipe > search(:role,":") {|r| puts r.name } webserver web lb micros => true chef:recipe >

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment