chef cookbooks

Chef is a powerful configuration management tool that turns infrastructure into code. With the help of Chef, Users can easily manage, configure and deploy the resources across the network from the central location of the environment (cloud, on-premises, or hybrid).

Cookbooks: Multiple Recipes can be grouped to form a Cookbook. A Cookbook defines a scenario and contains everything that is required to support that scenario:

Recipes specify the resources to use and the order in which they are to be applied

* Attribute values

*File distributions

*Templates

*Extensions to Chef, such as custom resources and libraries

Now we will create our first Cookbook.

Create a directory called cookbooks, and execute the below command to generate the Cookbook.

#mkdir cookbooks

#cd cookbooks

#chef generate cookbook httpd_deploy

Generating cookbook httpd_deploy

- Ensuring correct cookbook file content

- Ensuring delivery configuration

- Ensuring correct delivery build cookbook content

Your cookbook is ready. Type `cd httpd_deploy` to enter it.

There are several commands you can run to get started locally developing and testing your cookbook.

Type `delivery local --help` to see a full list.

Why not start by writing a test? Tests for the default recipe are stored at:

test/smoke/default/default_test.rb

If you'd prefer to dive right in, the default recipe can be found at:

recipes/default.rb

httpd_deploy is a name given to the Cookbook. You can give any name that you want and Let's move to this new directory httpd_deploy.

#cd httpd_deploy/

Now let us see the file structure of the created Cookbook

#tree

.

├── Berksfile

├── chefignore

├── metadata.rb

├── README.md

├── recipes

│   └── default.rb

├── spec

│   ├── spec_helper.rb

│   └── unit

│       └── recipes

│           └── default_spec.rb

└── test

    └── smoke

        └── default

Recent Comments

No comments

Leave a Comment