Ask Your Question
0

heat output attributes to a file in a server

asked 2014-08-29 15:55:54 -0500

neal gravatar image

updated 2014-08-29 15:56:24 -0500

Hi, All

I'm a newbie in Heat. I'm wondering if Heat is able to redirect the Output to one of the node it launches. For example, My heat is launching five nodes and I can get he IP addresses of all the nodes in output of heat template. Is it possible to redirect the IP Addresses to a file in one of the nodes? Thanks

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-09-23 06:32:11 -0500

unmesh-gurjar gravatar image

This can be done with the help of UserData. Please refer template [1], where the PublicIP of DatabaseServer is being updated/replaced (in file /usr/share/wordpress/wp-config.php).

[1] - https://github.com/openstack/heat-tem...

edit flag offensive delete link more
0

answered 2014-09-23 08:42:44 -0500

larsks gravatar image

If you want to accomplish something similar using HOT templates, take a look at this template, which gathers a list of "minion" nodes and includes them in a configuration file on the master.

In general, to do this sort of thing you use the str_replace function inside the user_data property of your server. The str_replace function looks like this:

str_replace:
  template: "...template text..."
  params:
    param1: value1
    param2: value2

For anything more than a single line, you'll use YAML's | operator to insert literal text, like this:

str_replace:
  template: |
    #!/bin/sh

    echo param1 > some_file
    echo param2 > another_file
  params:
    param1: value1
    param2: value2

The values in the params dictionary can be set using the same functions you use in the outputs section of your template. For example:

user_data:
  str_replace:
    template: |
      #!/bin/sh

      echo SERVER_IP > some_file
    params:
      SERVER_IP: {get_attr: [my_server_eth0, fixed_ips, 0, ip_address]}
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-08-29 15:55:54 -0500

Seen: 566 times

Last updated: Sep 23 '14