Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding chef cookbooks from github

Tags:

chef-infra

I've downloaded a number of cookbooks from the opscode site using the command: knife cookbook site install git for example. However now I would like to download a cookbook from a repository on github into my current cookbooks directory. How should I go about doing this? should I just clone the repository into my cookbooks directory?

Thank you!

like image 494
berto77 Avatar asked Jun 20 '12 05:06

berto77


People also ask

How do you upload cookbooks to chef server?

To upload a specific cookbook, go to the chef-repo directory, specify the cookbook name along with the cookbook directory as shown below. This will upload prod-db cookbook from local machine to the Chef Server. Please note that this will do the upload only if anything is changed in the cookbook locally.

What is cookbook and recipe in chef?

Cookbooks are fundamental working units of Chef, which consists of all the details related to working units, having the capability to modify configuration and the state of any system configured as a node on Chef infrastructure. Cookbooks can perform multiple tasks.


2 Answers

To download and manage cookbooks, you could use Berkshelf which comes with a way in itself to manage the cookbook dependencies by itself. If you are familiar with Ruby, it works like Gemfile. You could download cookbooks from github by adding this command in your BerksFile

cookbook 'nginx' , path : ' github url for cookbook'

like image 40
Agalya Loganathan Avatar answered Oct 19 '22 04:10

Agalya Loganathan


You coould install the knife github plugin from https://github.com/websterclay/knife-github-cookbooks, after which you could simply use knife cookbook github install cookbooks/yum to install yum from https://github.com/cookbooks/yum.

However, I would suggest using Librarian-Chef from https://github.com/applicationsonline/librarian, it works pretty much like bundler does for ruby gems (if you're familiar with that).

Edit: Since this apparently still receives views, I would be remiss not to mention berkshelf, which is amazing.

like image 195
Nils Landt Avatar answered Oct 19 '22 04:10

Nils Landt