Skip to content
DevOps Classroom Series – 22/Jan/2021
Just Enough ruby for Chef
- Chef is developed in ruby language, all the recipes which we work are ruby files, so we can use ruby to enhance chef.
- Refer Here for the chef ruby guide
- Ensure you install ruby extension to visual studio code
![Preview](https://i2.wp.com/directdevops.blog/wp-content/uploads/2021/01/chef100.png?w=800&ssl=1)
- Refer Here for ruby sample
Lets try to apply ruby in our cookbook
- Applied loops for existing cookbook Refer Here
- Now lets optimize further by create a new recipe called as lamp Refer Here
- Our cookbook still has improvements
- i’m hardcoding the package names and changes in recipes might lead to new versions so we need to handle this better
![Preview](https://i1.wp.com/directdevops.blog/wp-content/uploads/2021/01/chef101.png?w=800&ssl=1)
- During every convergance our apache server is getting restarted, this should not be the case