Creating a cookbook for Microsoft Azure VM


In the last article, we discussed about Creating a Template for Chef Cookbook
In this article we will discuss about cookbooks. A Cookbook is used by Chef – Configuration management tool to define a set of instructions or commands that need to be executed on managed node. In this post we will create a simple cookbook to install IIS Server on Windows Machine. In Our case, Windows Machine will be on Microsoft Azure IaaS.

Copy cookbook folder from startup kit to /root/

47.1-Chef-repo

Open a terminal in CentOS workstation and go to cookbooks directory. Execute chef generate cookbook webserver in terminal. It will create webserver folder in the cookbooks folder.

47.2-Chef cookbook Directory

Open the webserver cookbook folder and verify different directory automatically created by the chef generate command.

47.3 webserver cookbook

Edit default.rb file available in the recipe directory.

47.4 webserver cookbook recipies

We will write a recipe that will install IIS Server and create a Web page:

47.5 webserver cookbook recipies-default.rb

Done!

In the Next article we will discuss about Execute knife-azure to create Virtual Machine on Microsoft Azure

Leave a comment

Your email address will not be published. Required fields are marked *