ADMIN
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
mAnAgement<br />
chef<br />
© Alistair Cotton, 123RF.com<br />
Configuration management with Chef<br />
Chef de Config<br />
ever dream of rolling out a complete computer farm with a single mouse<br />
click? if you stick to Linux computers and you speak a little Ruby, chef can<br />
go a long way toward making that dream come true. By tim Schürmann<br />
over and making a mess on the server<br />
room floor.<br />
Valuable Ingredients<br />
Chef is basically a server that stores<br />
customized configuration guides for<br />
software. Clients connected to the<br />
server access the recipes and automatically<br />
configure their systems on<br />
the basis of the rulesets the recipes<br />
contain.<br />
To do so, the clients not only modify<br />
their configuration files, but – if<br />
needed – launch their package managers.<br />
If the recipes change, or new<br />
ones are added at a later date, the<br />
clients affected automatically update<br />
to reflect the changes. In an ideal environment,<br />
this just leaves it up to the<br />
administrator to manage the recipes<br />
on the server.<br />
Bulk Shopping<br />
Before you can enjoy the benefits,<br />
the developers behind Chef expect<br />
you to put in a modicum of work. For<br />
example, recipes are made up of one<br />
or multiple standard Ruby scripts. If<br />
you need anything beyond the fairly<br />
generic recipes available on the web,<br />
you need to have a good command of<br />
the Ruby scripting language. In other<br />
words, your mileage will vary before<br />
you deploy a home-grown and hometested<br />
solution.<br />
The installation is another obstacle<br />
– and a fairly complex one, too, because<br />
the Chef server depends on several<br />
other components, each of which<br />
in turn requires even more software<br />
packages. The Chef server itself is<br />
written in Ruby but relies on the RabbitMQ<br />
server and on a Java-based<br />
full-text search engine, at the same<br />
time storing its data in a CouchDB<br />
database.<br />
Finally, your choice of operating system<br />
is also important. Chef prefers<br />
Linux underpinnings, but it will also<br />
run on other Unix-flavored operating<br />
systems such as Mac OS X, Open<br />
Solaris, FreeBSD, and OpenBSD, according<br />
to the wiki [1]. The fastest<br />
approach today is offered by Debian<br />
5, Ubuntu 8.10 or later, or CentOS<br />
5.x. Setting up the server on any<br />
other system can be an adventure.<br />
This article mainly relates to Debian<br />
and Ubuntu for this reason. If this is<br />
the first time you have ever cooked<br />
one of Chef’s recipes, it is also a good<br />
idea to run your kitchen on a virtual<br />
machine. This prevents things boiling<br />
A full-fledged Chef installation comprises<br />
the systems you want to configure<br />
(nodes) and the server that manages<br />
and stores the recipes. Chef clients<br />
do all the hard work, picking up<br />
the recipes from the server via a REST<br />
interface and running the scripts.<br />
Each client runs on one node but can<br />
apply recipes to multiple nodes. [Figure<br />
1] shows you how this works.<br />
For simplicity’s sake, the following<br />
examples just use the Chef server and<br />
a single client. The latter only configures<br />
the computer on which it is running.<br />
The first thing you need to have<br />
in place is Ruby version 1.8.5 through<br />
1.9.2 (with SSL bindings). Add to<br />
this, RubyGems, which will want to<br />
build various extensions and libraries<br />
later on, thus necessitating the existence<br />
of make, gcc, g++, and the Ruby<br />
developer packages. Additionally, you<br />
need the wget tool for various downloads.<br />
The following command installs<br />
the whole enchilada on Debian<br />
and Ubuntu Linux:<br />
sudo apt‐get install ruby U<br />
ruby1.8‐dev libopenssl‐ruby1.8 U<br />
rdoc ri irb build‐essential U<br />
wget ssl‐cert<br />
68 Admin 01 www.Admin-mAgAzine.com