Look into using Berfshelf and the environment cookbook pattern. This design pattern puts all cookbooks in their own repos, public or private.
Specifically, for the configuration of particular servers, you can use a cookbook in a private repo with a recipe using node.set
as mentioned in that blog post. Or set attributes in the attributes/default.rb
with a statement like default['foobar']['version'] = '1.2.3'
. The open repo cookbooks that are not private can be berksified and run from the private cookbooks with include_recipe "{open-cookbook}::{open-recipe}"
.
I have used this design patter before in combination with knife-solo, especially since Berkshelf support was added in 0.4.x. Specifically, I use the command knife solo cook someuser@localhost --sync-only
. This will prepare the kitchen for installation on a target machine (download all berksified cookbooks, create solo.rb, etc. etc.) but not actually run the code. Or invoke as knife solo cook someuser@targetnode
to prepare, sync and run chef-solo on the target node.