Run script using Vendor Data JSON on OpenStack Ironic

asked 2018-12-10 17:01:32 -0600

c0dyhi11 gravatar image

updated 2018-12-10 18:26:48 -0600


I watched a video from the Sydney OpenStack Summit: (

I also read a blog post: (

I’m very interested in utilizing static vendor data in my OpenStack cloud. I was able to get a simple script to show up in vendor_data.json.

# curl
{"cloud-init": "#!/bin/bash\necho 'I am vendor data.' > /root/vendor_data.txt”}

What didn’t happen as I had hoped was that cloud-init actually executed this script.

I didn’t see any examples anywhere of actual scripts being executed. Do I have the key incorrect? "cloud-init"? I saw that on a RackSpace example: (

"cloud-init": "#cloud-config\nfinal_message: This is Vendor Data for the Austin OpenStack Summit Workshop by Rackspace Training"

This is also reference similar here: (

{"cloud-init":"#!/bin/bash\necho 'root:$6$<snip>' | chpasswd -e"}

I see this in the /var/log/cloud-init.log:

2018-12-10 20:48:58,005 -[DEBUG]: finish: init-network/consume-user-data: SUCCESS: reading and applying user-data
2018-12-10 20:48:58,005 -[DEBUG]: start: init-network/consume-vendor-data: reading and applying vendor-data
2018-12-10 20:48:58,005 -[DEBUG]: no vendordata from datasource
2018-12-10 20:48:58,005 -[DEBUG]: finish: init-network/consume-vendor-data: SUCCESS: reading and applying vendor-data

Any assistance would be very much appreciated.


Another useful bit of information that I'm not sure is relevant is this is OpenStack Ironic. And it looks like maybe cloud-init thinks this is Ec2? I'm looking into this now.

Thank you,

Cody Hill

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2018-12-11 23:16:42 -0600

c0dyhi11 gravatar image

Ok. Here is the resolution to the problem I had.

Cloud-Init does discovery when it tires to determine if a host is OpenStack those rules are as follows:

Maybe OpenStack if
 * non-x86 cpu architecture: because DMI data is buggy on some arches
Is OpenStack if x86 architecture and ANY of the following
  * /proc/1/environ: Nova-lxd contains product_name=OpenStack Nova
  * DMI product_name: Either Openstack Nova or OpenStack Compute
  * DMI chassis_asset_tag is OpenTelekomCloud

Since I'm using Ironic these are just showing up as physical hosts. So cloud-init is defaulting to EC2. What I needed to do was use the config-drive (Which is what the Ironic folks recommended). There is a different datasource for "OpenStack Local" or something like that... And that solved my problem.

A little about how I got vendor_data working since it's not documented very well IMHO.

To get "Static" vendor_data working via the metadata service (169.254.169..) you need to modify nova.conf for the nova API server. (Controller) and modify the following option:


Then create a json file at: /etc/nova/vendor_data.json

  "cloud-init": "#!/bin/bash\necho 'Hello World!' > /tmp/hello.txt"

Now in order to do this with config-drive like I had to. You'll need to setup the following across ALL of your compute nodes in nova.conf:

vendordata_jsonfile_path = /etc/nova/vendor_data.json
vendordata_providers = StaticJSON

Then create a json file at: /etc/nova/vendor_data.json

  "cloud-init": "#!/bin/bash\necho 'Hello World!' > /tmp/hello.txt"

I hope this helps someone else in my same situation.

Thank you,

Cody Hill

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2018-12-10 17:01:32 -0600

Seen: 543 times

Last updated: Dec 10 '18