Chef - Cookbook Dependencies


Advertisements


The features of defining cookbook dependencies help in managing cookbook. This feature is used when we want to use the functionality of one cookbook in other cookbooks.

For example, if one wants to compile C code then one needs to make sure that all the dependencies required to compile are installed. In order to do so, there might be separate cookbook which can perform such a function.

When we are using chef-server, we need to know such dependencies in cookbooks which should be decelerated in the cookbooks metadata file. This file is located at the top on the cookbook directory structure. It provides hints to the Chef server which helps in deploying cookbooks on the correct node.

Features of metadata.rb File

  • Located at the top in the cookbook directory structure.

  • Compiled when the cookbook is uploaded to Chef server using knife command.

  • Compiled with knife cookbook metadata subcommand.

  • Created automatically when the knife cookbook create command is run.

Configuration of metadata.rb

Following is the default content of a metadata file.

Metadata

Default Content

Advertisements