How to set environment variable for a VM at the time of launch?

asked 2017-05-15 07:27:06 -0500

Mohan gravatar image

I want to launch a VM with few of the environmetn variables set up at the time of launch. Is there a way to do this? Can I do this with Metadata tab at launch instance pop-up?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2017-05-15 07:36:27 -0500

eblock gravatar image

updated 2017-05-15 07:38:54 -0500

Hi, you have to use cloud-init for that kind of configuration during instance launch. Your base image needs cloud-init to be running, that way you can provide scripts and config options during the first launch of an instance. Read the docs for examples.

edit flag offensive delete link more

answered 2017-05-17 08:52:56 -0500

RHK gravatar image

You can place user data in a local file and pass it through the --user-data <user-data-file> parameter at instance creation.

$ openstack server create --image ubuntu-cloudimage --flavor 1 --user-data mydata.file VM_INSTANCE

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2017-05-15 07:27:06 -0500

Seen: 958 times

Last updated: May 17 '17