Last Updated: July 24, 2020
·
1.556K
· tmassman

Set up a chef server on debian with fabric

There are several ways documented on how to install a chef server. I'm lazy, I like python and I don't want to repeat myself. So I wrote this little script with fabric.

This script will:

  • prepare the server for chef
  • install chef
  • install and configure nginx
  • download the chef validation key

You can find the complete code at https://gist.github.com/4675413.

Preparations on your side

  1. Set up a VM or server with Debian (Ubuntu should work as well, but it's not tested).
  2. Add valid server certificates (chef-api.crt, chef-api.key, chef.crt, chef.key) to the working directory.

Configuration Options

Change the environment variables according to your setup:

api.env.chef_api_prefix = 'chef-api'
api.env.chef_prefix = 'chef'
api.env.domain = 'yourdomain.com'

The default setup would generate a nginx config for:

Run it!

fab deploy -H your_new_chef_host_ip

The script will also download the chef validation for you.