Heat Orchestration Template

OpenStack Heat templates are used for orchestration of cloud applications.

Heat orchestration templates are written in YAML.

Murano applications are associated with Heat Orchestration Templates.

The Heat Orchestration format is as follows.

heat_template_version: <version date in yyyy-mm-dd format>

description:
  #a description of the template
 #add at least one meaningful line that describes what the user can do with the template

parameter_groups:
  #a declaration of input parameter groups and order
  #specify how the input parameters should be grouped and the order in which the parameters must be provided.
  #section is optional and can be omitted when it is not required.

parameters:
  #declaration of input parameters
  #input parameters that have to be provided when instantiating the template
  #the section is optional and can be omitted when no input is required
  #use of parameterized values instead of hard-coded values makes the template reusable.
  #default values for input parameters can be provided

resources:
  #declaration of template resources
 #the resources section is required and must contain at least one resource definition.

outputs:
  #declaration of output parameters
  #output parameters available to users once the template has been instantiated.
  #the section is optional and can be omitted when no output values are required.
  #use the section to provide output to users.

conditions:
  #declaration of conditions
  #include statements that can be used to restrict when a resource is created or when a property is defined

Following is an example of a Heat orchestration template.

heat_template_version: 2015-10-15

description: >
  The Apache HTTP Server Project is a collaborative software development effort
  aimed at creating a robust, commercial-grade, featureful, and freely-available
  source code implementation of an HTTP (Web) server.

parameters:
  image:
    type: string
    description: A Linux image with the apt-get or yum commands available
    constraints:
      - custom_constraint: glance.image
  key_name:
    type: string
    description: SSH public key used by the server
    constraints:
      - custom_constraint: nova.keypair
  flavor:
    type: string
    description: flavor used by the server
    constraints:
      - custom_constraint: nova.flavor
  network:
    type: string
    description: Network used by the server
    constraints:
      - custom_constraint: nova.network
resources:
  apache_http_server:
    type: OS::Nova::Server
    properties:
      flavor: { get_param: flavor }
      image: { get_param: image }
      key_name: { get_param: key_name }
      networks:
        - network: { get_param: network }
      config_drive: true
      user_data_format: RAW
      user_data: |
        #!/bin/bash

        echo "Starting cloud-init Apache installation"
        apt-get update
        apt-get -y install apache2

outputs:
  name:
    description: Name of the apache http server instance
    value: { get_attr: [apache_http_server, name] }
  first_address:
    description: First IP address of the instance
    value: { get_attr: [apache_http_server, first_address] }

Refer to OpenStack’s Heat Orchestration Template (HOT) Guide for a detailed explanation about the structure of a Heat template.