OpenStack Orchestration: Getting Started with Heat

OpenStack Heat

Heat Orchestration Service provides ability to orchestrate Openstack requests, such as creation of instances, volumes and other OpenStack services, using  YAML based templates languages called HOT(Heat Orchestration Template).

Heat consists of following services:

  • heat-api service serves HTTP RESTful API that process requests and responses.
  • heat-api-cfn is a CloudFormation compatible API service to heat.
  • heat-api-cloudwatch monitors metrics for the orchestration service.
  • heat-engine service  process templates and orchestrates their launch.

Installation

When installaing OpenStack with Packstack, by default Heat Orchestration service is not installed. If you already installed OpenStack and you want to add HEAT service to an already existing deployment you have 2 options:

Manual Installation:

Follow the manual steps in the upstream guide, which includes:

Installation of needed RPM packages

# yum install openstack-heat-api openstack-heat-api-cfn openstack-heat-engine \ python-heatclient

Log into the Database and create a new Heat database with needed privileges:

$ mysql -u root -p

CREATE DATABASE heat;

GRANT ALL PRIVILEGES ON heat.* TO ‘heat’@’localhost’ \ IDENTIFIED BY ‘password’;

GRANT ALL PRIVILEGES ON heat.* TO ‘heat’@’%’ \ IDENTIFIED BY ‘password’;

Source needed Keystone environment parameters to obtain admin access

# source keystonerc_admin

Create a new user for Heat service:

# keystone user-create –name heat –pass password

and few more boring manual steps:

http://docs.openstack.org/juno/install-guide/install/yum/content/heat-install-controller-node.html

Packstack:

The other option, which is the better choice for the lazy and more time efficient folks, that got tiered of manually creating database tables, use Packstack to install heat packages and run all needed configurations automatically. This is obviously applicable only if you already installed OpenStack using PackStack and you want to add HEAT service.

The first step is to edit the PackStack generated answers file, which is located at /root/packstack-answers-########-######.txt, change CONFIG_HEAT_INSTALL=n to CONFIG_HEAT_INSTALL=y, Then run packstack again with edited  answers file:

#  packstack --answer-file= /root/packstack-answers-########-######.txt

Packstack will re-run all puppet modules, and amend changes from the auto-generated answers file. As we now included Heat, this will install all heat packages and append needed configuration.

Warning: Do not run on Production! if you made any manual changes on any of the configuration files(which most probably you did) this will definitely revert them!

HOT Hello World

Let’s save a simple HOT template from HOT Guide to local file /root/stack-hello-world.hot

# cat /root/stack-hello-world.hot
heat_template_version: 2013-05-23

description: Simple template to deploy a single compute instance

resources:
  my_instance:
    type: OS::Nova::Server
    properties:
      key_name: key_cirros
      image: cirros
      flavor: m1.small

This example runs a single Nova instance of  Cirros image that is automatically loaded with RDO Installation. HEAT supports lots of nifty stuff. You cant take a look at HOT specification for the complete list of actions and options, and resource types list for the complete list of HEAT resources types you can orchestrate, get inspired of what can be automated:

Heat Orchestration Template (HOT) Specification:

http://docs.openstack.org/developer/heat/template_guide/hot_spec.html

HEAT Resource Types:

http://docs.openstack.org/developer/heat/template_guide/openstack.html

 

Running Heat HOT from Command Line

Before running heat commands, source needed credentials:

# source /root/keystonerc_admin

and run you fist heat stack:

# heat stack-create -f /root/stack-hello-world.hot stack-hello-world
| id  | stack_name        | stack_status       | creation_time        | 
| ### | stack-hello-world | CREATE_IN_PROGRESS | 2014-12-09T13:57:08Z |

Once Heat completes creating the stack it will be listed as completed:

# heat stack-list 
| id  | stack_name        | stack_status    | creation_time        |
| ### | stack-hello-world | CREATE_COMPLETE | 2014-12-09T14:11:16Z |

 

How it looks in Horizon web UI

Screenshot from 2014-12-09 16:22:51

Share If You Care

2 Trackbacks & Pingbacks

  1. Three Essential OpenStack Deployment and Validation Tools | PHP World
  2. 5 new guides for using OpenStack

What do you think about this?