Ask Your Question
0

Instance name

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

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.

eg:

server_0:
    type: OS::Nova::Server
    properties:
      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

Comments

Or use cloud-init to set the hostname directly.

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

1 answer

Sort by ยป oldest newest most voted
0

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

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

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. https://docs.openstack.org/developer/....

Or use cloud-init to set the hostname directly.

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: 2017-03-04 17:47:32 -0500

Seen: 127 times

Last updated: Mar 13 '17