A hack to configure workstations with chef

One of things that I used to hear a lot from people was, "How can we use chef to configure developer workstations?" or other kinds of unmanaged hosts.


Most of the solutions I have come across don't fit my use case for one of the following reasons:
  1. They require adding the workstation as a node to the chef server. This adds unnecessary complexity.
  2. They use chef-solo instead of chef-zero, which is less flexible and harder to test.
  3. They don't leverage Berkshelf for cookbook mangement, which makes it harder to customize things.
Since I'm starting to get back into chef development after a long break, I thought it would be a fun problem to tackle. In particular I wanted to see if I could use chef-zero in a vacuum, without requiring the user to do much setup.

My Solution

I use chef-zero and Berkshelf to execute chef-client locally. This can be done in a couple of commands on a workstation or "dumb" VM. Assuming a Debian or Debian derivative host:
apt-get install ruby rake git sudo
git clone https://github.com/christopherdeutsch/devbox.git
rake bootstrap
The configuration defaults can either be edited directly in the attributes/default.rb file (if you are lazy like me), or the Right Way by editing the zero.json file. I'd imagine if anyone else were to use this they would fork the repo and set up their defaults as needed.

My Use Cases

  1. Developer laptop. It's a pain for a developer to add a node to a chef server, generate a client key, and so on. It's relatively easy to git clone and edit a JSON file.
  2. Dumb VirtualBox VM. I am a UNIX guy but I have a Windows computer at home I use primarily for gaming. I have no interest in installing ChefDK under windows for chef development; I'd rather just install Debian on a VirtualBox and do the chef development there.

Other Solutions

This problem has been attacked several times over the years. See also:


Popular posts from this blog

Monitoring with statsd and CloudWatch

Xen, "hwcap 0 nosegneg", and -mno-tls-direct-seg-refs

A Grand Adventure: compiling transmission on my home router