Instance name

asked 2017-03-04 17:47:32 -0600

allmaya gravatar image

I need to follow a naming convention of 16 characters for my instance name ,but I want the hostname to just have first 8 characters. Is there a way I can get my server instance name and pass that as a hostname within the same template.


    type: OS::Nova::Server
      name: abcdefgh
      image: { get_param: image_name }
      flavor: { get_param: flavor_name }
      key_name: { get_param: key_name }

Within the same the template I should get the instance name and parse it using some resource type.

%hostname%: { get_attr: [ server_0 , name ] }
echo %hostname% | cut -c 1-5 > /etc/hostname
edit retag flag offensive close merge delete


Or use cloud-init to set the hostname directly.

Bernd Bausch gravatar imageBernd Bausch ( 2017-03-04 19:29:49 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-03-04 19:29:30 -0600

updated 2017-03-13 09:46:42 -0600

rbowen gravatar image

Using user data, you could send the instance name to a shell script that runs on the instance and sets the hostname at boot time. See e.g.

Or use cloud-init to set the hostname directly.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2017-03-04 17:47:32 -0600

Seen: 158 times

Last updated: Mar 13 '17