Get parameter from instance and use it in heat template function

asked 2016-12-19 01:24:30 -0500

demirayar gravatar image

I am using Mitaka Openstack on Ubuntu. I want to assign a floating IP to OpenStack instance with heat template. On my instance, there is a configuration file (such as /tmp/ip.txt) like this ;

[root@instance-1 ~] cat /root/ip.txt


I want to get the IP address from this file, then use as a floating IP and associate to my instance. How can I get the IP address which is written on my configuration file with heat template? Is there a way to get parameter from instance via cloud-init? And also, is it possible to use this parameter ($floating_ip) with "OS::Neutron::FloatingIP" resource?

edit retag flag offensive close merge delete

1 answer

Sort by ┬╗ oldest newest most voted

answered 2016-12-21 09:32:02 -0500

zaneb gravatar image

OS::Neutron::FloatingIP has a floating_ip_address property that you can use to get a chosen floating IP address. However, this is restricted to administrators in the default Neutron policy. In general, cloud tenants don't get to dictate to clouds what resources they are assigned; that just isn't a robust way of building a multi-tenant system. I'd suggest that you're doing it backwards, and you should be telling the server what floating IP address it got assigned by Neutron rather than the other way around.

In case that doesn't make the question moot (i.e. you're an admin on a private cloud, you don't care about interoperability, and you're determined to do it this way around) then the easiest way is probably to create a software deployment that cats the file to its output, which can then be accessed through the deploy_stdout attribute.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2016-12-19 01:24:30 -0500

Seen: 163 times

Last updated: Dec 21 '16