DevOps Classroom Series – 14/Nov/2021

Chef Cookstyle

  • This helps in writing better chef infra cookbooks.
  • Command : cookstyle <path to cookbook>
  • Also apply necessary metadata as done in the class Refer Here
  • Refer Here for the changes made.

Tomcat 9 Installation

  • Now our cookbook located at Refer Here is properly tested and is eligible to upload to chef server.
  • Now lets upload this cookbook using berks

Chef Supermarket

  • Chef Supermarket is a platform where opensource community shares their cookbooks.
  • We can use those cookbooks along with the recipes which we develop or use them straight away in the run_list.
  • Refer Here for the supermarket website
  • Lets try to install mysql on ubuntu 2004 using supermarket cookbook and lets also install java 11
  • Lets try to find the mysql cookbook shared by community
  • Refer Here for the documentation.
  • When you use supermarket cookbooks, we need to ensure we read the documentation as we have to use the cookbook as developed by the third party
  • Lets create a cookbook called as springbootexample
  • Lets create a recipe for installing java called as java and create an attributes file default
  • Now lets configure kitchen to create ubuntu20.04 in any cloud env (in this example i will be using aws )
  • Refer Here for the initial set of changes
  • Now we want to install mysql suing the supermarket cookbook Refer Here
  • Add dependecny to your cookbook by adding the highlighted in the below image with depends in metadata.rb
  • Now to download dependencies i.e mysql and its dependencies, berkshelf (berks) is a tool which can download the dependencies from supermarket.
  • Lets install the dependencies by executing berks install
  • Generally when we use cookbooks from supermarket there are two kinds of usage
    • Cookbooks which have custom resources developed
    • Cookbooks where we need to include_recipe or add the recipe to run_list
  • Refer Here for the changes done to add mysql installation using supermarket cookbook
  • Lets try to add nginx installation using supermarket cookbook Refer Here.
  • Refer Here for the nginx installation
  • Refer Here for the changes.

Next Steps

  • Using Roles
  • Using Environments
  • Using databags
  • Setting Attributes
  • Chef on Windows
  • Installing our own chef server.

Leave a comment

Turn on JavaScript to leave a comment.

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

Please turn AdBlock off
Social Network Integration by Acurax Social Media Branding Company
Exit mobile version
%%footer%%