Ask Your Question
0

heat variable substitution

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

Simply_Seth gravatar image

In my heat template the following does not work:

 etcd:
    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

peer-addr:blank:7001

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
1

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

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

1 follower

Stats

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

Seen: 370 times

Last updated: Dec 08 '14