DevOps Classroom Series – 01/Jun/2021

Improving Cookbook

  • Lets understand Ruby basics
  • Installing ruby
# Windows
choco install ruby

# brew for mac
brew install ruby
  • Refer Here for some ruby samples

  • Improved the cookbook

    • created loops for multiple package statements Refer Here
  • The default.rb in recipes folder is used to call other recipes in cookbook or to throw errors if the recipe is executed on unsupported os

  • Now lets create a recipe called as lamp Preview Preview

  • Recipe name is cookbook-name::recipe-name

  • To call one recipe from another we use a resource include_recipe <recipe-name>

  • Refer Here for the cookbook changes and hash example of ruby


  • Refer Here for the ohai generated on ubuntu node
  • Whenever convergence happens, chef will run the ohai tool and the information collected by ohai can be accessed like a ruby_hash.
  • Chef creates a hash object called as node
  • Refer Here for using node object in recipe.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin