New Question

userdata script not being run by cloudbase-init

asked 2018-08-07 04:02:52 +0300

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Just wondering if anyone can shed some light on what it is I am doing wrong here.

I have 2 simple test powershell scripts that I am loading into userdata as a multi-part mime. The scripts apprear on the server and the encoding etc appears to be fine as I can run them manually once logged on to the server.

My issue is that I cannot figure out why they are not being executed automatically but the cloudbase-init process.

I have a log of the init process that can be found at

Thanks in advance.

Cheers, Glyn

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2018-08-09 21:05:01 +0300

avladu gravatar image


Here are some examples of valid Heat templates:

cloudbase-init has only one script entry point, a kind of int main(void) that will execute, all other scripts will be just saved and possible used as dependencies.

The file name from the multipart mime SHOULD be: cfn-userdata.

Example on how to define the init script:

Thank you,
Adrian Vladu

edit flag offensive delete link more

answered 2018-08-07 06:15:20 +0300

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

So I did a bit more experimentation and found that if I could get the script into the LocalScripts location they would get them run if I stored them in RAW format.

Here is a brief example:

    type: string
    description: testing userdata content
    default: |
      Set-Content -Path "C:\test_3.txt" -Value "This is test_3's output!"

    type: OS::Heat::CloudConfig
        - path: C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts\test_3.ps1
          content: { get_param: file_content }
    type: OS::Nova::Server
      name: testbox
      flavor: { get_param: flavour }
      key_name: { get_param: key }
        - port: { get_resource: port }
      user_data_format: RAW
      user_data: {get_resource: boot_config}
      block_device_mapping: [{ device_name: "vda", volume_id : { get_resource : volume }, delete_on_termination : "true" }]

I would like to know if there is a better way to do this?

In case it helps Cloudbase-Init version: 0.9.11

Cheers, Glyn

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

Question Tools

1 follower


Asked: 2018-08-07 04:02:52 +0300

Seen: 896 times

Last updated: Aug 09 '18