This repository contains chef cookbooks and recipes for the provision of my laptop.
Chef provides a means to provision a (cluster of) machine.
Because we do not want to depend on a chef-server we opt to use the chef-solo instance.
In this section the procedure for getting the provision of a laptop up and running is described here. A summary is given below.
- Ubuntu (12.10)
- Git
- Clone Repository
- Install Chef Solo
- Run Chef Solo
Install the latest version of Ubuntu.
Execute the command below to install git.
sudo apt-get install git
Git is used to retrieve this repository which contains all the utility scripts, cookbooks and recipies needed to get started.
Choose an appropriate directory in which to clone this repository. In that directory execute the following command
git clone git://github.com/dvberkel/chef-solo-laptop.git
This will clone the repository into a directory called
chef-solo-laptop
.
Chef Solo need to be installed to run the various cookbooks and recipies. Detailed information can be found on the installation page at Opscode. We will list the commands that need to be executed.
We are using the Opscode APT repository. This way it is easy to keep Chef up to date. Execute the following command to add the Opscode APT to the source list.
echo "deb http://apt.opscode.com/ `lsb_release -cs`-0.10 main" | sudo tee /etc/apt/sources.list.d/opscode.list
The next step is adding the OpsCode GPG key so the downloads can be verified.
sudo mkdir -p /etc/apt/trusted.gpg.d
gpg --keyserver keys.gnupg.net --recv-keys 83EF826A
gpg --export [email protected] | sudo tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
Update the index with the following command
sudo apt-get update
And install opscode-keyring
to keep the keyring up to date.
sudo apt-get install opscode-keyring # permanent upgradeable keyring
To ensure we use the latest libraries that Chef depends on we have to upgrade the installation.
sudo apt-get upgrade
Finally install chef via apt-get.
sudo apt-get install chef
Because we are only intend to run Chef Solo the Chef Server Url can be set to 'none'. (The install script has these values preseeded.)
Now that Chef Solo is installed we should use it. Execute the following command to provision your laptap.
sudo chef-solo -c solo.rb -j node.json
This will execute the recipe in
cookbooks/basic_setup/recipes/default.rb
The basic setup for the computer is described in the basic-setup
cookbook, in particular in the
default
recipe.
The documentation about resources is a good place to start understanding the syntax of various elements in the recipes.