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
-
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
Ohai
- 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.