This blog post was created by Anil Gupta. Additional comments and reviews: Maya Shiran and Xiao Gao
In this blog post I will talk about the automation and orchestration of configuration that can be done via the Heat automation and orchestration program that comes with OpenStack (and VIO- VMware Integrated OpenStack).
Perhaps, a question on your mind is “Why do I need an orchestration solution such as Heat when I have access to the OpenStack Command Line Interface (CLI)”. Imagine if you are configuring a simple virtual infrastructure that consists of a web server, an application server, and a database server. You not only have to deploy the three instances, you will need to deploy one network instance per server. You also need to account for the router to connect to the outside world, and the floating IP that will be assigned to the web server so that users can access the application. Making one-off API\CLI calls to deploy these components is fine during development. However, what happens when you’re ready to go to production? What if performance tests shows that our deployment requires multiple instances at each infrastructure tier? Managing such an infrastructure using CLI is not scalable.
This is where Heat comes in. Heat is the main project of the OpenStack orchestration program and allows users to describe deployments of complex cloud applications in text files called Heat Orchestration Templates (HOT). These templates, created in simple YAML, format are then parsed and executed by the Heat engine. For example, in your template, you can specify the different types of infrastructure resources you will need, such as servers, floating IP addresses, storage volumes, etc. The template also manages relationships between these resources (such as this volume is connected to this server), which allows it to handle complex configurations. These templates are then parsed and executed by the Heat engine to create all of your infrastructures in the correct order to completely launch your application.
Heat also offers the ability to add, modify, or delete resources of a running stack using the stack update operation. If I want to increase the memory of a running machine, It is as simple as editing the original template and apply the changes using heat stack-update.
As a result, Heat provides a single deployment mechanism to provision the application infrastructure from detailed template files that minimizes room for error. Due to the simplicity of the YAML format, your template files can also be used as a documentation source for IT operation runbooks. Additionally, the Heat templates can be managed by version control tools such as git, so you can make changes as needed and ensure the new template version is used in future. Finally, the Integration of VIO 4.0 with vRA (vRealize Automation) provides enterprise customers the ability to consume VIO resources with governance.
The Heat template consists of two sections. The first part defines the parameters such as image id and instance type. The second part defines the resources that are managed through this template. All of these variables can be parameterized and the template can be made generic. Once you have parameterized these variables, you can specify appropriate values for your environment in the stack-create command without having to edit the template file. This allows you to create fairly complex orchestration scenarios using Heat templates that are reusable.
Below is an example template that shows two sections – the first section defines the various parameters, as noted above. The second section creates a configuration for load-balancer (LB) server, along with needed router and network configurations. You will see orchestration at work in this example, because creation step for LB server on the private subnet needs to wait for router interface step to complete, otherwise the creation step for LB server fails. Please note that the code example is only for illustration purposes and not intended to run on Heat as-is. Complete working example can be found here
You will see the use of value_specs in the example below, which is a way of providing vendor-specific key/value config options.
This template, when run, invokes the OpenStack orchestration service using the OpenStack Open API, which in turn leverages the core OpenStack services (such as Nova, Cinder, Glance and Neutron) in VIO for automated creation and management of the specific resources.
This post showed how VIO with Heat allows developers to create their infrastructure configuration as code, as well as orchestrate the routine steps such as provisioning servers, storage volumes, networks, as well as dependencies in a quick and easy manner.