Ask Your Question
0

Heat: how to provide the user_data script path

asked 2016-04-25 09:53:27 -0500

TejasG gravatar image

Hi, I have trying to execute cloud init script (post boot), but not sure how to provide the file path. part of the template looks like this. Also "heat-preview" shows that, always file mentioned in default section of "parameter" is passed to resources, thought we pass different file name from "environemnt.yaml" file.

  parameter:
      config_file:
        type: string
        default: cloudfile.sh

  resources:
      config_drive: "true"
      user_data : 
        str_replace: 
          template: |
            { get_file : cloudfile.sh }
          params: 
            $config_file: { get_param: config_file }

In my case "cloudfile.sh " is placed in same directory where launcher.yaml and environment.yaml files are located.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-06-13 15:51:06 -0500

Muzammil gravatar image

You will have to use OS::Heat::SoftwareConfig or OS::Heat::SoftwareComponent to do that.

OS::Heat::SoftwareComponent - to be used when you want to execute different scripts over the lifecycle of VM (for instance when it will be created, updated, suspended , resumed) see this https://github.com/openstack/heat-templates/blob/master/hot/software-config/example-templates/example-sw-component-template.yaml (OS::Heat::SoftwareComponent example)

OS::Heat::SoftwareConfig to be used when you want to do a simple configuration via some script one time, without taking lifecycle of VM / script into account. Search for its example and you'll get some good material.

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: 2016-04-25 09:52:27 -0500

Seen: 1,363 times

Last updated: Apr 25 '16