Skip to content

Instantly share code, notes, and snippets.

@mattsnyder
Forked from julien51/gist:160263
Created June 22, 2010 12:43

Revisions

  1. @julien51 julien51 created this gist Aug 3, 2009.
    42 changes: 42 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    #!/bin/bash

    echo "Setting up chef..."

    sudo apt-get -y update
    sudo apt-get -y install ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert

    cd /tmp
    wget http://rubyforge.org/frs/download.php/57643/rubygems-1.3.4.tgz
    tar zxf rubygems-1.3.4.tgz
    cd rubygems-1.3.4
    sudo ruby setup.rb --no-ri --no-rdoc
    sudo ln -sfv /usr/bin/gem1.8 /usr/bin/gem

    sudo gem source -a http://gems.opscode.com/

    sudo gem install ohai chef --no-ri --no-rdoc

    echo 'file_cache_path "/tmp/chef-solo"
    cookbook_path "/tmp/chef-solo/cookbooks"' > /tmp/solo.rb

    echo '{ "chef": { "server_fqdn": "chef.domain.com" }, "recipes": "chef::client" }' > /tmp/chef.json

    sudo chef-solo -c /tmp/solo.rb -j /tmp/chef.json -r http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz

    chef-client

    echo "Done! Please, register this client..."
    echo "[Press any key when done]"

    read
    echo "Adding the node"

    chef-client

    echo "All set, you can now add a role to this node."
    echo "[Press any key when done]"

    read
    echo "Configuring the node..."

    chef-client