Chef Blogs

Chef & VMware Integration

Matt Ray | Posted on | partners

VMware joined us at #ChefConf 2014 as a Gold sponsor and speaker. We’re working with VMware to jointly improve our offering as showcased at ChefConf.

VMware’s vCloud Application Director (vCAD) lets you build deployment blueprints with a drag and drop interface for vCloud Automation Center (vCAC). vCAD provides a variety of ways to integrate with your Chef-managed infrastructure.

To make this real we’ve decided to deploy and demo a 3-tier demonstration web application.

Setup:
Download the vmware-vcad-chef-repo from GitHub. Upload the cookbooks managed with Berkshelf and the webapp role.

[ruby] berks upload –no-freeze –halt-on-frozen -b ./Berksfile
knife role from file base.rb database.rb webapp.rb [/ruby]

vCAD Workflow:
For the demo we created a new “Chef-managed Service”. Within the Service we added a Version and specified the Supported OSes of CentOS 6.3, 6.4 and Ubuntu 12.04 on 32 and 64-bit platforms.

vCAD provides a Lifecycle of INSTALL, CONFIGURE, START, UPDATE, ROLLBACK, and TEARDOWN to supported Actions for the Service. We populated the Properties for the Service with the Chef server URL and organization, the validation.pem, the node’s run list and environment. To map the Lifecycle back to typical Chef usage:

● INSTALL installs the chef-client
● CONFIGURE writes the client.rb and downloads the validation.pem
● START, UPDATE and ROLLBACK call chef-client with options for the Environment, run list and loading a JSON file.
● TEARDOWN is not currently used, but we could call knife to have the node delete itself and its client.

The services are combined in the “Chef 3-tier webapp demo” Application. The Chef-managed Service is deployed on supported OS Templates and the properties of the virtual machines or the services may be overridden. We added a script to write out any properties into an “appd.json” file to load as Chef attributes. We created dependencies between the Services, so the database node is followed by the application servers which are followed by the HAProxy load balancer. The advantage of VCAD’s Application is that we may define the deployment order of the nodes to provide lightweight orchestration without worrying about the underlying cloud or virtualization solution.

We can then deploy the node to a Deployment Profile that supports our configuration, such as VMware’s vCloud or Amazon’s EC2. This is the stage where a user will set their Service Properties for their validation.pem and their Chef server organization (and/or server URL if necessary). After final review the nodes are deployed in the proper order to the cloud of your choice in just a few minutes. Chef configures the nodes, using search to connect the application servers to the database and to configure load-balancing with HAProxy automatically.

Within the Deployment Execution Plan you can view the output of each Lifecycle event for the Service, the START shows the output of the chef-client run.

The nodes are on the Chef server and available via ‘knife node list’. If you were to use the “base” role included in the repository with the “users” data bag properly populated you will have SSH access to all the nodes as well.

This demonstrates how easy it is to get started integrating Chef into your VMware vCloud Application Director deployment. You can watch the ChefConf session below. This demo is also published on VMware’s Solution Exchange.