- Chef - Chef-Client Run
- Chef - Nodes
- Testing Cookbook with Test Kitchen
- Chef - ChefSpec
- Chef - Foodcritic
- Chef - Testing Cookbooks
- Chef - Chef-Shell
- Chef - Chef-Client as Daemon
- Chef - Environment
- Chef - Roles
- Chef - Cookbook Dependencies
- Chef - Cookbooks
- Chef - Solo Setup
- Chef - Knife Setup
- Chef - Test Kitchen Setup
- Chef - Client Setup
- Chef - Workstation Setup
- Chef - Version Control System Setup
- Chef - Architecture
- Chef - Overview
- Chef - Home
Advanced Chef
- Chef - Community Cookbooks
- Chef - Files & Packages
- Chef - Blueprints
- Lightweight Resource Provider
- Chef - Resources
- Chef - Cross-Platform Cookbooks
- Chef - Scripts for Data Bags
- Chef - Data Bags
- Chef - Environment Variable
- Chef - Definition
- Chef - Libraries
- Chef - Ruby Gems with Recipes
- Chef - Plain Ruby with Chef DSL
- Chef - Templates
- Dynamically Configuring Recipes
Chef Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Chef - Cookbooks
Cookbooks are fundamental working units of Chef, which consists of all the details related to working units, having the capabipty to modify configuration and the state of any system configured as a node on Chef infrastructure. Cookbooks can perform multiple tasks. Cookbooks contain values about the desired state of node. This is achieved in Chef by using the desired external pbraries.
Key Components of a Cookbook
Recipes
Metadata
Attributes
Resources
Templates
Libraries
Anything else that helps to create a system
Creating a Cookbook
There are two ways to dynamically create a cookbook.
Using chef command
Using knife utipty
Using Chef Command
To create an empty cookbook using Chef command, run the following command.
C:Usersvipinkumarm>chef generate cookbook <Cookbook Name> C:Usersvipinkumarm>chef generate cookbook VTest Instalpng Cookbook Gems: Compipng Cookbooks... Recipe: code_generator::cookbook * directory[C:/Users/vipinkumarm/VTest] action create - create new directory C:/Users/vipinkumarm/VTest * template[C:/Users/vipinkumarm/VTest/metadata.rb] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/metadata.rb - update content in file C:/Users/vipinkumarm/VTest/metadata.rb from none to 4b9435 (diff output suppressed by config) * template[C:/Users/vipinkumarm/VTest/README.md] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/README.md - update content in file C:/Users/vipinkumarm/VTest/README.md from none to 482077 (diff output suppressed by config) * cookbook_file[C:/Users/vipinkumarm/VTest/chefignore] action create - create new file C:/Users/vipinkumarm/VTest/chefignore - update content in file C:/Users/vipinkumarm/VTest/chefignore from none to 15fac5 (diff output suppressed by config) * cookbook_file[C:/Users/vipinkumarm/VTest/Berksfile] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/Berksfile - update content in file C:/Users/vipinkumarm/VTest/Berksfile from none to 9f08dc (diff output suppressed by config) * template[C:/Users/vipinkumarm/VTest/.kitchen.yml] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/.kitchen.yml - update content in file C:/Users/vipinkumarm/VTest/.kitchen.yml from none to 93c5bd (diff output suppressed by config) * directory[C:/Users/vipinkumarm/VTest/test/integration/default/serverspec] action create - create new directory C:/Users/vipinkumarm/VTest/test/integration/default/serverspec * directory[C:/Users/vipinkumarm/VTest/test/integration/helpers/serverspec] action create - create new directory C:/Users/vipinkumarm/VTest/test/integration/helpers/serverspec * cookbook_file [C:/Users/vipinkumarm/VTest/test/integration/helpers/serverspec/sp ec_helper.rb] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/test/integration/helpers/serverspec/spec_helper.rb - update content in file C:/Users/vipinkumarm/VTest/test/integration/helpers/serverspec/spec_helper.rb from none to d85df4 (diff output suppressed by config) * template [C:/Users/vipinkumarm/VTest/test/integration/default/serverspec/default _spec.rb] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/test/integration/default/serverspec/default_spec.rb - update content in file C:/Users/vipinkumarm/VTest/test/integration/default/serverspec/default_spec.rb from none to 758b94 (diff output suppressed by config) * directory[C:/Users/vipinkumarm/VTest/spec/unit/recipes] action create - create new directory C:/Users/vipinkumarm/VTest/spec/unit/recipes * cookbook_file[C:/Users/vipinkumarm/VTest/spec/spec_helper.rb] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/spec/spec_helper.rb - update content in file C:/Users/vipinkumarm/VTest/spec/spec_helper.rb from none to 587075 (diff output suppressed by config) * template[C:/Users/vipinkumarm/VTest/spec/unit/recipes/default_spec.rb] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/spec/unit/recipes/default_spec.rb - update content in file C:/Users/vipinkumarm/VTest/spec/unit/recipes/default_spec.rb from none to 779503 (diff output suppressed by config) - create new file C:/Users/vipinkumarm/VTest/recipes/default.rb - update content in file C:/Users/vipinkumarm/VTest/recipes/default.rb from none to 8cc381 (diff output suppressed by config) * cookbook_file[C:/Users/vipinkumarm/VTest/.gitignore] action create - create new file C:/Users/vipinkumarm/VTest/.gitignore - update content in file C:/Users/vipinkumarm/VTest/.gitignore from none to 33d469 (diff output suppressed by config)
The cookbook structure with the name VTest will be created in the directory and following will be the structure for the same.
Using Knife Utipty
Use the following command to create a cookbook using knife utipty.
C:UsersvipinkumarmVTest>knife cookbook create VTest2 WARNING: No knife configuration file found ** Creating cookbook VTest2 in C:/chef/cookbooks ** Creating README for cookbook: VTest2 ** Creating CHANGELOG for cookbook: VTest2 ** Creating metadata for cookbook: VTest2
Following will be the structure of the cookbook.
Advertisements