Ask Your Question

Is it possible to launch instance based on parameter passed to the heat template

asked 2014-07-31 15:18:58 -0500

phoenix_controller gravatar image

updated 2014-08-01 08:59:36 -0500

For example, I have two nova instances defined in the template. 1. Oracle 2. MSSql and I have a boolean parameter isOracle that will be specified by the user when the stack is created. Similar to imageId and flavorId

Is there a tag/condition I can use so that only one of the instances are launched. So lets say, if isOracle is true, only instance 1 will be launched, and vise versa. So even if there are 2 nova instances defined in the template, only one will be brought up depending on the parameter input.

edit retag flag offensive close merge delete


where would this parameter come from?

smaffulli gravatar imagesmaffulli ( 2014-07-31 18:54:15 -0500 )edit

it would come in as a parameter to the template where the user will specify when creating the stack. Similar to image id and flavor id

phoenix_controller gravatar imagephoenix_controller ( 2014-08-01 08:58:38 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2014-08-04 04:39:12 -0500

There is currently no way to make boolean decisions within Heat templates. I handle this in the crude manner of launching only a single instance and making the decision within the UserData being executed at a node level.

There are several other ways this could be handled (salt, chef, puppet), but they all rely on them all using the same OS on the instance.

edit flag offensive delete link more


Thank you for the suggestion, unfortunately the actual scenario is way more complicated than a database type selection. I guess I was really hoping for the AWS condition support but I guess it is not yet implemented.

phoenix_controller gravatar imagephoenix_controller ( 2014-08-05 08:53:54 -0500 )edit

answered 2014-08-04 11:19:38 -0500

zaneb gravatar image

Conditional resources are not currently supported in Heat, although the idea has been discussed and may happen in the future.

One approach to solve your immediate problem would be to create separate provider templates for the Oracle and MSSql servers. Give the "database server" resource in your main template a made-up type (like MyDatabaseServer) and then use the environment to map that type to whichever of the two provider templates you want in each instance.

The other approach mentioned by @AndyHardwick, to allow the configuration management system on the server to make the decision, could also work well in many circumstances.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2014-07-31 15:18:58 -0500

Seen: 1,807 times

Last updated: Aug 04 '14