heat variable substitution

asked 2014-12-01 14:27:48 -0500

Simply_Seth gravatar image

In my heat template the following does not work:

    addr: $private_ipv4:4001
    peer-addr: $private_ipv4:7001

by not work, I mean that the IPs do not show up in the config file in CoreOS

The result is usually:

addr: blank:4001


The only way I've seen around this is to hardcode the IP's in the template

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-12-08 10:45:38 -0500

zaneb gravatar image

Heat does not automatically substitute resource attributes into the environment variables of scripts (and it's not suggested anywhere that it does, so I'm not sure why anyone would think it might). Perhaps you are attempting to perform the substitution elsewhere in the template, but it's impossible to debug without some more context.

In general, the way to get data like the private IP address of a server is using the get_attr intrinsic function. There are a number of ways to then substitute it into a script. You could do it directly using the str_replace intrinsic function, or dynamically through an input to a SoftwareDeployment resource. For the latter to work you'll also need the guest agent and hook installed - it's quite possible that this is what you're missing, since the script hook is the part that exports SoftwareDeployment inputs as environment variables.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2014-12-01 14:27:48 -0500

Seen: 399 times

Last updated: Dec 08 '14