This is a guest blog from HP’s Phil Prasek and Gunjan Kamle detailing the integration between Chef and HP OneView for provisioning bare metal resources.
What if you could bring the simplicity of public cloud infrastructure as code to your private data center? Great news – now you can with the new Chef Provisioning Driver for HP OneView. You can define a single source of truth with Chef recipes that include bare-metal machine configuration and deploy them as part of an automated continuous integration and delivery process.
Here’s how it works: HP OneView provides a clean REST API and AMQP message bus for complete control and visibility of your bare-metal infrastructure, using the same semantics you expect from the public cloud. REST APIs are provided for bare-metal server, storage, networking, and OS deployment. Bare-metal machine templates and profiles simplify management at scale and focus on provisioning up to the OS, which makes it a perfect fit for Chef provisioning to layer on top.
In this short video, Gunjan and I give an overview of the solution, a demo, and a code walkthrough of the Chef Provisioning Driver for HP OneView, including the REST API calls.
Five steps to get you started quickly
Step 1: Configure your HP OneView server templates
Log in to your HP OneView appliance and create server profile templates, which are used to define the prototypical configuration for machine instances with consistent compute, network, and storage configurations.
Step 2: Configure OS build plans (OS deployment appliance)
The HP OneView deployment appliance, Insight Control server provisioning (ICsp), provides many pre-packaged build plans. We will need to add a small Chef-related script to an existing build plan. Login to ICsp, click on OS Build plan to edit it, and add an additional Shell script build step located on GitHub.
Step 3: Create and upload a cookbook to your Chef server
Download and extract the Chef Provisioning driver for HP OneView on your workstation. Locate the knife.rb.example file under the examples\.chef folder. Copy it and rename your copy knife.rb. Then edit it to include your Chef, HP Oneview and ICsp authorization details, along with the required server provisioning attributes such as IP addresses, DNS, gateways, and so forth.
Chef recipes provide the customization of the servers you wish to provision. To use our example cookbook to install a simple web application, follow the instructions on driver usage example in our GitHub repository README. You can also create your own cookbook or use an existing cookbook on the Chef Supermarket to configure your new server.
Upload your chef cookbook using a simple knife upload command:
Example: knife cookbook upload ‘Your_Chef_Recipe’
Step 4: Start the provisioning
You now have everything in place, and the provisioning can begin. Chef will use the Knife configuration file and provisioning recipe in conjunction with the HP OneView driver to provision our server. Chef will go through the entire build process—from bare-metal hardware to the installation and configuration of the application stack to continual management with Chef.
Open a command window and switch to the directory containing your new Chef recipe. Then enter the following commands to (1) download the required Ruby gems, and (2) execute the recipe. Fill in the appropriate path to your recipe in the second command.
$ bundle install
$ bundle exec chef-client -z path_to_provisioning_recipe.rb
Chef will immediately begin running your recipe.
Step 5: Sit back and relax while your servers are provisioned
You can see the servers being configured on the HP OneView web interface and if desired, you can open consoles to look at the progress.
Chef will bootstrap the new server, which includes downloading the Chef client software and registering the new server with the Chef server. It will then start a Chef-client run on the new server, which will allow it to pull the necessary cookbooks from the Chef server and apply your recipes.When finished, your server is provisioned and running the complete application stack you defined. You can now continue managing and configuring it using Chef.
Reach out to the HP Datacenter Care-Infrastructure Automation (DC-IA) Center of Excellence (CoE) with questions on the Chef Provisioning Driver for HP OneView and the integration we can provide as part of HP’s DC-IA service.
To learn more:
- Chef provisioning for HP OneView whitepaper
- #HPOneView, #HPOneView-Chef, #HPDCCare
About the authors:
Phil Prasek is Chief Technologist, HP OneView at Hewlett-Packard. Gunjan Kamle is the technical lead for the HP Datacenter Care-Infrastructure Automation Center of Excellence (CoE).