One of the things I love about vCAC is it’s ability to integrate with just about anything right out of the box. I am often asked if we can integrate with other automation solutions and how we complement them. Many customers are already using open source solutions like puppet and chef and have invested in those technologies. Yet many still struggle with being able to tie it all together into a solution that their developers and application teams can consume. Since vCAC is the easiest solution on the market to stand up a self service portal it is a no brainier to use it as the front end. Add to that vCAC’s unique governance features to control whom can access what and when and you have a powerful cloud solution that is made for the requirements of your organization. Not the masses.
Watch the quick demo of this solution here How to Cook with vCAC and Chef
First off, this how to guide is a not about Chef. It is not really even designed exclusively for Chef. You could use this for any of the popular open source solutions like Puppet and Salt for example. With that said I am not going to discuss a lot about how Chef works. There are plenty of resources already available on that. If you are reading this you should already have a good understanding of technologies like Chef. In this guide I am using the free hosted Chef. You can get your own by visiting https://getchef.opscode.com/signup , there you can get a free version of hosted Chef that allows up to 5 nodes. I have never used Chef before writing this. I followed the guide at https://learnchef.opscode.com/quickstart/workstation-setup/ and a lot of goggle searches to get Chef up and running. This example is using a run list to install Chef Recipes. It could easily be modified to add the Provisioned VM to a role so you can run multiple run lists. For example if you wanted the requester to choose a Lamp Stack.
In this example I am using Linux. To be specific I am using CENTOS 6.3. The technique is the same for all Linux flavors that vCAC supports. I also plan a follow-up post for Windows as most of the mechanics are the same with just some little differences based on Windows Architecture.
Before we start, you will need to have a blueprint setup in vCAC that is mapped to a Linux template in vCenter that already has the Chef client installed and configured as well as the Linux Guest Agent for vCAC
Use Putty to login to the Linux Template with Chef client installed and the vCAC Linux Guest agent and change to the Chef-Repo directory and create a new Shell script named cookbook.sh
vi cookbook.sh
Enter the following and save the file by holding Shift and type ZZ (NOTE: there is a hard return after the cd /home/chef-repo
cd /home/chef-repo knife bootstrap localhost --ssh-password $1 --run-list "recipe[$2]" >> knife.log
Shutdown the VM and create a snapshot if you are planning to use linked clone in vCAC or if this was mapped to a blueprint in vCAC already you can use the following guide:
You should verify that you can converge a node and deploy a cookbook on the Linux template prior to moving on to the next steps. This guide is assuming that you already have a working Chef installation. Deploy the blueprint we just created and try to run knife and deploy a catalog manual after vCAC provisions the VM
When you know that vCAC can provision the template and you can successfully converge the node with the Chef client we are ready to move on
Now we will create a Property Definitions to create our drop down menu in vCAC, login to vCAC as an Infrastructrue administrator and navigate to Infrastructrue, BluePrints then Property dictionary and click New Property Definition
Enter the information as shown and click the green check box. I also made it available below so you can copy and paste.
Copy and Paste text:
Chef.cookbook Additional Software? Please choose
Valuelist Cookbook apache2, mysql
Now we need to create a build profile, Navigate to Build Profiles and click the green + to add a New Build Profile
Enter the following by adding a new property: Also in clear text below so you can copy and paste
Chef.cookbook Chef.Password this is the root password of your Linux Template Chef.User VirtualMachine.Admin.UseGuestAgent true VirtualMachine.Customize.WaitComplete true VirtualMachine.Software0.Name cookbook.sh VirtualMachine.Software0.ScriptPath /home/chef-repo/cookbook.sh {Chef.Password} {Chef.cookbook} VMware.VirtualCenter.OperatingSystem rhel5_64Guest
Now go to your Blueprint that is mapped to the template we created and click edit, then browse to the custom properties tab and select the new build profile
Pingback: How to cook with vCAC and Chef | VMtoCloud.com
Really nice work and write up! Thank you.
Are you still planning on a write up for a Windows guest?