Chef on a Raspberry Pi

So OpsCode (or now GetChef) doesn’t have an omnibus installer for the ARM/Raspberry Pi, but it’s pretty easy to get it setup.

Start with the base default Raspbian (wheezy) and get it where you can ssh.
Run the following on the Pi:

sudo apt-get install rubygems bundler
sudo gem install chef —verbose

Then on your workstation this to bootstrap:

knife bootstrap -N NODENAME -x pi -P raspberry --sudo IP_of_rPi

You need to set the nodename explicitly as the hostname under raspbian is “raspberrypi” and you probably want something else. The -x and -P options are the default raspbian creds.

You will want recipes to fix the following in your cookbooks:

  • Remove the default “pi” user
  • Add your own user account
  • set the Hostname to the Nodename

Lastly, the following If condition will detect if you’re on a Pi and behave differently

if node['platform'] != "raspbian"