Skip to content

scmGalaxy

A Platform for Software Engineers

  • Classes
  • Courses
  • Certifications
  • Tutorials
  • Trainers
  • Blogs
  • Contact

Tag: Chef cookbooks

Know about metadata.rb and metadata.json in Chef

by scmgalaxy KAugust 18, 2015February 27, 2021ChefLeave a Comment on Know about metadata.rb and metadata.json in Chef
Know about metadata.rb and metadata.json in Chef

metadata-rb-and-metadata-json-in-chef

What is Metadata in chef?

In order to understand cookbooks without evaluating them every files, we generate metadata about cookbooks

What is metadata.rb?

Before unerstanding about metadata.json, we need to understand about metadata.rb.

Every cookbook requires a small amount of metadata. Metadata is stored in a file called metadata.rb that lives at the top of each cookbook’s directory. The contents of the metadata.rb file provides hints to the Chef server so that cookbooks are deployed to each node correctly.

A metadata.rb file is never interpreted directly. Rather, the metadata.rb file provides a simple location to store and edit data that is then compiled by the Chef server and stored as JSON data.

Metadata is compiled whenever ….

1. a cookbook is uploaded to the Chef server or

2. when the knife cookbook metadata subcommand is run. knife creates a metadata.rb file automatically whenever the knife cookbook create subcommand is run.

metadata.json

metadata.json is generated from metadata.rb. to generate or regenerate the Chef cookbook metadata, which creates a new ‘metadata.json’ file from the ‘metadata.rb’ file.

From the command line of your Chef development server, enter the following command:

# knife cookbook metadata my-cookbook -o <COOKBOOK_PATH>

Example:  # knife cookbook metadata my-cookbook-name -o /opt/development/cookbooks/

A metadata.json file can be edited directly, should temporary changes be required. Any subsequent upload or action that generates metadata will cause the existing metadata.json file to be overwritten with the newly generated metadata. Therefore, any permanent change to metadata that is required should only be made in the metadata.rb file.

What if metadata.rb and metadata.json both are present in cookbooks?

If a cookbook contains both a metadata.rb and metadata.json at cookbook load time, the metadata.rb will be preferred. This should be swapped around to ensure that dynamically built metadata which has been compiled is read properly without error.

knife cookbook upload reads metadata.rb and ignores metadata.json. It generates the data from the .rb file, and uploads that. It does not create a metadata.json file, on disk or in the cookbook itself–this is just metadata in the cookbook object.

Tagged : Chef / Chef cookbooks / Chef Guide / Chef Tutorials / Cookbooks / Metadata / Metadata in chef / metadata.json / metadata.rb / What / What is metadata.json / What is metadata.rb

Need Assistance!!!

Feel Free To Contact Us
1800 889 7977
(India Toll Free)

+91 7004 215 841
(Worldwide)

Email us
Contact@DevOpsSchool.com

Categories

Website Stats

Number of posts: 2,404
Number of users: 36

Recent Posts

  • Python Tutorials: Complete Reference
  • Powershell Error – A parameter cannot be found that matches parameter name ‘AllowPrerelease’.
  • Powershell Error – The term ‘Install-PSResource’ is not recognized as the name of a cmdlet
  • DevopsSchool Review and Customer Feedback
  • Datadog error
  • Splunk Error: port is already bound
  • Splunk Error: insufficient privileges
  • Gitlab error: pwsh”: executable file not found in %PATH%
  • Read event trigger on image downloading from s3
  • How to get notification when someone download and upload files to AWS S3 Bucket?
  • Dynatrace Error: with Kubernetes
  • Laraval Error: Replicating claims as headers is deprecated and will removed from v4.0
  • Appdynamics Error – Machine Agent is not starting successfully
  • Appdynamics Error – ERROR StatusLogger Reconfiguration failed
  • Appdynamics Error – Agent license request denied
  • AppDynamics Enterprise Console Installation Error
  • The Different Types of Sport Betting
  • Best Blog website for Health and Fitness
  • How can we understand Django?
  • (no title)

Archives

  • Free Video Tutorials
  • DevOps School
  • Best DevOps
  • scmGalaxy
  • Artificial Intelligence
  • DataOps
  • AIOps
  • GuruKul Galaxy
  • DevOps Consulting
  • DevOps Freelancers
  • DevOps Trainer
  • Free Ebooks
  • School for Debugger
  • Holiday Landmark
  • Surgery Planet
  • My Hospital Now
  • My Medic Plus
  • ProfessNow
  • Cotocus
  • Stocks Mantra
  • I Reviewed
© Copyright 2022 scmGalaxy. All rights reserved | MadeBy99colorthemes