Ask Your Question
1

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

Comments

where would this parameter come from?

smaffulli ( 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 ( 2014-08-01 08:58:38 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
1

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

Comments

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 ( 2014-08-05 08:53:54 -0500 )edit
0

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Get to know Ask OpenStack

Resources for moderators

Question Tools

Follow
1 follower

Stats

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

Seen: 823 times

Last updated: Aug 04 '14