Another Look at an OpenStack Heat Template

In an earlier post, I provided an introduction to OpenStack Heat, and provided an example Heat template that launched two instances with a logical network and a logical router. Here I am going to provide another view of a Heat template that does the same thing, but uses YAML and the HOT format instead of JSON and the CFN format.

Here’s the full template (click here if the code box below isn’t showing up):

I won’t walk through the whole template again, but rather just talk briefly about a couple of the differences between this YAML-encoded template and the earlier JSON-encoded template:

  • You’ll note the syntax is much simpler. JSON can trip you up on commas and such if you’re not careful; YAML is simpler and cleaner.
  • You’ll note the built-in functions are different, as I pointed out in my first Heat post. Instead of using Ref to refer to an object defined elsewhere in the template, HOT uses get_resource instead.

Aside from these differences, you’ll note that the resource types and properties match between the two; this is because resource types are separate and independent from the template format.

Feel free to post any questions, corrections, or clarifications in the comments below. Thanks for reading!

Tags: , , ,

  1. raja’s avatar

    Hi Scott,

    Is there a way to specify queues in HOT? when you instantiate a switch –both ports and queues are important (refer to OF-CONFIG examples). The idea would be to instantiate Openflow Switches using HOT.

    thanks
    -raja

  2. slowe’s avatar

    Raja, I don’t think so, but check the OpenStack Heat Resource Types page at http://docs.openstack.org/developer/heat/template_guide/ to see if there are any queuing abstractions present. Keep in mind that any queueing functions may or may not apply to physical switches; it all depends on the Neutron plugin being used.

  3. Prashant’s avatar

    Can we download an image through heat template (HOT) and use it later on to launch an instance?
    just like glance ,which is a command line interface,where we able to download images.

  4. slowe’s avatar

    Prashant, to my knowledge you can’t download/add Glance images via Heat. Heat expects that images have already been added to Glance.

  5. Kedar’s avatar

    Is it possible to write a shell script that will download image using glance command and then execute a template using heat command?

  6. slowe’s avatar

    Kedar, it should be possible to write a shell script that will download an image, add it to glance, and then execute a Heat template. Look into using the glance and heat command-line clients; they should help you accomplish what you’re seeking. Good luck!

Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>