Chef solo - SumitBisht/checklist_and_guides GitHub Wiki
Setting up servers with Chef-Solo
1. buy a VPS (like linode)
2. install ruby and chef solo
you can run this script as root for installing ruby and chef
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
gem install chef ruby-shadow --no-ri --no-rdoc
then you can do
ruby -v
and
chef-solo -v
3. setting up the dierectory structure
we want the following basic directory structure for chef cookbooks
/var/chef
├── cookbooks
│ └── main
│ ├── recipes
│ │ └── default.rb
│ └── templates
│ └── default
│ └── zshrc.erb
├── node.json
└── solo.rb
then, the contents of node.json
should be like
{
"run_list": ["recipe[main]"],
}
and the solo.rb
cookbook_path File.expand_path("../cookbooks", __FILE__)
json_attribs File.expand_path("../node.json", __FILE__)
you can see a simple recipe with a template in the repository
4. run chef-solo
chef-solo -c solo.rb
Notes
- this guide was tested with ubuntu 12.04