Ask Your Question
0

How can I use a 1 based index for naming servers in a ResourceGroup?

asked 2016-06-16 20:09:24 -0500

patrickmslatteryvt gravatar image

So I have a working Heat ResourceGroup as follows:

resources:
  servers:
    type: OS::Heat::ResourceGroup
    properties:
      count: { get_param: server_count }
      resource_def:
        type: { get_param: template }
        properties:
          ssh_key: { get_param: ssh_key }
          parent_stack_id: { get_param: "OS::stack_id" }
          server_image: { get_param: server_image }
          server_flavor: { get_param: server_flavor }
          server_name:
            str_replace:
              template: ${STACK}-%index%
              params:
                ${STACK}: { get_param: "OS::stack_name" }

And this creates servers with names like this:

server-0
server-1
...
server-10

But what we would really like to have are servers named with a 1 based index like this:

server-01
server-02
...
server-10

Is there any way to do this in Heat? (I'm using Rackspace so it should be the current OpenStack release)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-07-29 12:03:26 -0500

zaneb gravatar image

Yes, but for it to work conveniently you'll need the fix for bug 1585206 which merged in Newton (only about 2 weeks ago actually).

(I don't know Rackspace's release schedule, but my understanding is that they chase trunk with some small delay. So you probably won't have to wait for the Newton release to get the fix, but I have no idea when you will get it.)

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-16 20:09:24 -0500

Seen: 464 times

Last updated: Jul 29 '16