2
votes

A chef repo is used to manage multiple cookbooks, roles, policies, etc. Here is a chef repo template. Is there some standard command line way that lets us create the blank chef repo (with all the boilerplate code of course), without having to clone the git repository every time.

There is one to create a cookbook:

berks cookbook create <cookbookname>     # Using berkshelf

But I am not aware of any such command to create a chef-repo.

2

2 Answers

4
votes

I think the official way these days is to get the Chef DevKit.

ChefDK has a command for chef generate app <chef-repo-name>. The old method, mentioned below has been deprecated. The github chef-repo directs the user to get ChefDK in the README.

Most tutorials suggest something like this and is what I've been doing...

root@intro:~# wget http://github.com/opscode/chef-repo/tarball/master
root@intro:~# tar -zxf master
root@intro:~# mv opscode-chef-repo* chef-repo
root@intro:~# rm master

I've forked it to my own git repo, so I could customize it with my personal details. A generic method of instantiating the repo is not the best option anyway unless you are making a lot of repos on the same machine.

4
votes
  1. Download/install Chef DevKit
  2. Add chef and ruby to your path (if not already done, see below for more info)
  3. $ chef generate repo chef-repo (note: last argument is name for your chef repo)

Adding chef/embedded-ruby on your path on mac

$ echo 'export PATH="/opt/chefdk/embedded/bin:$PATH"' >> ~/.bash_profile && source ~/.bash_profile

$ echo 'export PATH="/opt/chefdk/bin:$PATH"' >> ~/.bash_profile && source ~/.bash_profile