/franchise

an opinion on managing chef-solo installs

Primary LanguageShellMIT LicenseMIT

Franchise

Franchise is a "framework" for managing debian based chef-solo installs. After pasting around various bits from different projects, I extracted them into a common generator, allowing you to create franchises easily. For an example of this structure see monitorbox.

Dependencies

  • gem install berksfile (ruby 1.9 only)
  • pip install fabric
  • debian based host

How it works

Here's a high level view of the execution model:

  1. Berkshelf is run against a Berksfile, copying all cookbooks and their dependencies to the vendor/cookbooks directory. If any custom cookbooks are specified, they are also copied from cookbooks/.
  2. Fabric is run against a target host, along with the username and password (if needed).
  3. If this is the first time fabric runs, it will "bootstrap" the host, installing chef-solo and other support tools.
  4. Once bootstrapped, your cookbooks and roles are uploaded to the host.
  5. Chef-solo is run against your runlist, which runs through your cookbooks.

For more detail, view the fabfile.py.template

Installation

Clone the project:

git clone git@github.com:capotej/franchise.git ~/.franchise_sub

For bash users:

echo 'eval "$($HOME/.franchise_sub/bin/franchise init -)"' >> ~/.bash_profile
exec bash

For zsh users:

echo 'eval "$($HOME/.franchise_sub/bin/franchise init -)"' >> ~/.zshenv
source ~/.zshenv

Generating an franchise

Once installed, usage is very simple:

franchise new ircbox 

This will create a franchise ircbox/ in the current directory.

Running it

cd ircbox
fab --user=root --password=hihaters chef:hosts=11.22.33.44

This will bootstrap the host and install the "ntp" recipe from opscode into 11.22.33.44

Specifying cookbooks

If the cookbook you want is an Opscode Community Cookbooks, you can just specify it in the Berksfile. See the Berkshelf website for more information on specifying dependencies via git or http.

IMPORTANT Once specified as a dependency, you need to chef to actually install it, this is done by adding the name of the cookbook to the runlist

Customizing cookbooks

Sometimes the cookbook you want to install isnt available or doesn't exist. In this case, just drop your cookbook into the cookbooksdirectory and specify it in the Berksfile as such:

cookbook "runit", path: "cookbooks/runit"