
Why should I use Berkshelf instead of chef?
As terrific as Chef is, Berkshelf can really make a difference in the way you manage your Chef cookbooks and dependencies. Berkshelf lets you treat your cookbooks the way you treat gems in a Ruby project. When external cookbooks are used, Berkshelf doesn’t require “knife cookbook site” to install community cookbooks.
Where should Berkshelf look for cookbooks?
A source defines where Berkshelf should look for cookbooks. Sources are processed in the order that they are defined in, and processing stops as soon as a suitable cookbook is found. Locations include a private or public Supermarket, Chef Infra Server, or local Chef repository.
How to install chef cookbooks on nodes with Berkshelf?
All we have to do is mention the dependent cookbooks with its version number. When Chef client runs on nodes, berkshelf will automatically download and install all the dependent cookbooks from the Opscode cookbook community for us. Berkshelf requires a bit of set up.
What is the goal of Berkshelf?
The goal of Berkshelf is to manage a cookbook outside of Chef repository in isolation. Berkshelf is a Command Line tool which can act as a source code management tool or a package manager like gem, apt, yum, etc.
What is a Berkfile?
Berkshelf is a Command Line tool which can act as a source code management tool or a package manager like gem, apt, yum, etc. It replaces portions of knife like generating, uploading & downloading Cookbooks.
What is a Berksfile in Chef cookbook?
Berksfile is for dependency management for cookbooks. Consider a case where my cookbook is using a community cookbook from chef supermarket. In this case, first I need to download that community cookbook from supermarket and upload it along with my own cookbook to chef server.
What is metadata in chef?
A metadata. rb file is: Located at the top level of a cookbook's directory structure. Compiled whenever a cookbook is uploaded to the Chef server or when the knife cookbook metadata subcommand is run, and then stored as JSON data. Created automatically by knife whenever the knife cookbook create subcommand is run.
What is chef solo?
Chef-Solo is an open source tool that runs locally and allows to provision guest machines using Chef cookbooks without the complication of any Chef client and server configuration. It helps to execute cookbooks on a self-created server.
What are the chef shell modes?
We can run Chef-Shell in three different modes: Standalone mode, Client mode, and Solo mode. Standalone mode − It is the default mode. No cookbooks are loaded, and the run-list is empty. Client mode − Here, the chef-shell acts as a chef-client.
Where is Knife RB located?
When running Microsoft Windows, the knife. rb file is located at %HOMEDRIVE%:%HOMEPATH%\. chef (e.g. c:\Users\
How do I install chef gems?
Use the chef_gem resource to install gems into the instance of Ruby that is dedicated to the chef-client. Use the gem_package resource to install all other gems (i.e. install gems system-wide). In short - if you want Chef to use it, use chef_gem , otherwise use gem_package .
What is Chef_zero?
Chef Zero is a simple, easy-install, in-memory Chef server that can be useful for Chef Client testing and chef-solo-like tasks that require a full Chef Server. It IS intended to be simple, Chef 11+ compliant, easy to run and fast to start. It is NOT intended to be secure, scalable, performant or persistent.
What is chef OHAI?
Ohai is a tool that is used to collect system configuration data, which is provided to the chef-client for use within cookbooks. Ohai is run by the chef-client at the beginning of every Chef run to determine system state.
What is chef vagrant?
The Vagrant Chef Solo provisioner allows you to provision the guest using Chef, specifically with Chef Solo. Chef Solo is ideal for people who are already experienced with Chef, already have Chef cookbooks, or are looking to learn Chef.
Installing Berkshelf
You will need Ruby installed on your system. Also, Berkshelf comes integrated with Chefdk, so installing Chefdk will automatically give you berks installed:
Berksfile
Berksfile is the most crucial component of Berkshelf! It’s just like metadata for Chef. However, the usage is somewhat different. Berksfile makes it simple to download a dependency cookbook from chef supermarket (or other places) and upload to the cookbook repository on the server. Here is the usual content inside it:
Creating a Cookbook with Berkshelf
This is almost the same like Knife creates cookbooks, however, it will have some more files/directories available inside the cookbook. We are only concerned with Berksfile.
Installing Cookbooks and their dependencies
So, this is the thing we are mainly interested in. This will resolve all the dependencies and install cookbooks whatever is available in the Berksfile.
Uploading the cookbook and its dependencies
Once you have installed your cookbooks and dependencies, it is time to upload them to Chef server. Just go inside your cookbook where all of your dependencies are mentioned in Berksfile and where you ran install command. Run below command.
Installation
Berkshelf is now included as part of the Chef-DK. This is fastest, easiest, and the recommended installation method for getting up and running with Berkshelf.
Configuration
Berkshelf will search in specific locations for a configuration file. In order:
Just what is Berkshelf?
You often won’t need to actually write your cookbooks from scratch, as the community has all kinds of them – often ready to use in your environment without modification – available from the Opscode supermarket. To use a cookbook, you’ll need to download it and save it on your Chef workstation.
Implementing Berkshelf
Berkshelf requires a bit of set up. The easy way to install Berkshelf is:
Further reading
We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
