I didn’t think it was possible, but since the acquisition of ManageIQ things have gotten even busier. There are a lot of people working around the clock to ensure a high quality delivery of product and deliver new capabilities throughout our portfolio. It’s really exciting to see such a comprehensive portfolio being brought together by all of the teams at Red Hat and I believe customers will be pleasantly surprised in the near future.
I’ve recently begun to work on a plan to train our field engineers on Enterprise Cloud Management (ECM). One of my goals as part of the training was to be able to quickly build up an entire classroom environment for at least 20 students. Quickly being minutes, not days. One of the great things about ECM is that is delivered as an appliance. This makes for an easy deployment. I wanted to avoid all the clicking through the Web Admin interface to deploy 20 virtual machines from a template. I also wanted the names of the virtual machines in the RHEV-M console to match the hostnames in DNS they would receive.
For this reason I wrote a quick ruby script, named automate_build.rb. I tried to keep it as generic as possible with all environment specific variables referenced in the first few lines so others could reuse it. The script assumes you’ve already imported the OVF and have a template available to base the VMs from. The script does several things including:
- Accepts user input for the cluster they’d like to create the VMs on
- Accepts user input for the template name they’d like to use as a basis for the VMs
- Accepts user input for the number of VMs they’d like to build
- Proceeds to build the VMs based on the input from above
- Writes a file that can be included in the dhcp.conf containing the correct static entries using the MAC addresses of the VMs that were built in the previous step
This means that with a few pieces of input one could deploy many virtual machines from a template and have the VM names match DNS entries based on static entries.
For the sake of completeness I will also create an automated teardown script named automate_destroy.rb. For now this functionality could just as easily be achieved by shift+clicking a group of virtual machines in the Web Administration console of RHEV-M and removing them. In the future I may attempt to use the build and destroy scripts to perform more advanced lab setup, so having a scripted removal process may prove more useful. Some lab scenarios that might be useful to students in the future could include:
- Identifying which virtual machines are causing high resource utilization on a host
- Performing capacity analysis for a cluster
- Comparing virtual machines for differences
With this framework in place I could easily add scenarios to be built into the automate_build.rb and automate_destroy.rb scripts and have a lab ready quickly. Here is a quick screencast showing the script in action.
I hope to be able to share more with you in the future on this training environment and I hope you find the scripts useful!