I don't want to use Chef Server as for now, but rather want to leverage Chef Solo. I need to keep configs (attributes and files) of particular servers in a separate Git repo. This is needed to keep cookbooks in an open repo while hiding configs in a private repo.
Is there a built-in possibility in Chef to get attributes and files from Git repo? How do you usually fetch them?
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 theattributes/default.rb
with a statement likedefault['foobar']['version'] = '1.2.3'
. The open repo cookbooks that are not private can be berksified and run from the private cookbooks withinclude_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 asknife solo cook someuser@targetnode
to prepare, sync and run chef-solo on the target node.