Ask Your Question
1

Heat::ResourceGroup : how to pass IPs of all instances in str_replace : param list

asked 2016-06-02 04:40:19 -0600

abdul.chetpet gravatar image

updated 2016-06-02 11:42:55 -0600

I have a Heat::ResourceGroup defining a dynamic number of instances. And after instantiation, I need to pass the IPs assigned to each of these instances to another Admin-instance using :

str_replace:
           params:
             instance_count  : { get_param: instance_count }
             inst-1_ip   : { "Fn::Select" : [ "0", { get_attr: [instance, inst_private_ip] } ] }
             inst-2_ip   : { "Fn::Select" : [ "1", { get_attr: [instance, inst_private_ip] } ] }
           template: |
             ...

However, the problem am facing is can we have a conditional check that if (instance_count > 1), then inst-2_ip is initialized

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2016-06-09 04:01:23 -0600

abdul.chetpet gravatar image

All prior versions before ‘2015-10-15’ had the constraint that get_attr can only take a number / string attribute. However, since version ‘2015-10-15’, get_attr can print lists / mappings as well.

Hence, by changing the template version and using get_attr to pass the entire list of IPs to the host template, I could further work with shell scripting to extract the individual IPs assigned to each of the instances belonging to the resource group.

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

Get to know Ask OpenStack

Resources for moderators

Question Tools

Stats

Asked: 2016-06-02 04:40:19 -0600

Seen: 250 times

Last updated: Jun 09 '16