0
votes

I wish to use chef zero with vagrant for provisioning developer environments. These developers are involved in application development and are not involved in maintaining chef recipes.

I have a chef server which acts as a repository for all chef components. Is it possible to configure chef zero with this chef server, so that a developer can leverage the roles and environments?

I can use berkshelf to download cookbooks using chef_api but role's runlist and environment's attributes will have to replicated in Vagrant file.

The advantage with this approach is that a developer can replicate production or QA environments by changing environment in Vagrantfile.

1

1 Answers

1
votes

As you have discovered Berkshelf is a great tool for managing cookbooks, but there is no equivalent tool for managing entities like roles, environments and databags. This makes sense as these entities amount to pieces of global data specific to a particular instance of chef.

There are alternative ways to work-around this:

  1. Use "application" cookbooks containing "role recipes" that detail the desired run-list
  2. Export the desired roles and environments and keep a copy in the vagrant repo

Application cookbook pattern

Instead of using a role you use a recipe from a special "application" cookbook. Each recipe is designed to capture the run-list of a particular component of your application: db, appserver, router, etc.

For example the "myapp::db" recipe:

include_recipe "mysql::server"
include_recipe "database"
include_recipe "myapp::_db_schema"

And the "myapp::appserver" recipe

include_recipe "apache2"
include_recipe "php"
..
include_recipe "myapp::_appserver_setup1"
include_recipe "myapp::_appserver_setup2"

The major advantage of this approach over roles is the ability to revision control changes to the run-list (dev/test/prod) and the use of a tool like Berkshelf to control chef server loading.

Export roles and environments from chef server

If you have admin credentials it's easy to export data from chef server. See:

http://docs.opscode.com/knife_download.html