Skip to content

Instantly share code, notes, and snippets.

@jblachly
Last active March 9, 2022 07:49
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jblachly/fc6b2a0cb2b86be21446 to your computer and use it in GitHub Desktop.
Save jblachly/fc6b2a0cb2b86be21446 to your computer and use it in GitHub Desktop.
SmartOS (standalone) cloudinit setup for KVM images

The following keys, when placed in the customer_metadata section of the VM definition JSON will effect the specified behaviour:

smartos key corresponds to cloudinit key effect
hostname local-hostname
root_authorized_keys public-keys copies to /root/.ssh and default user ~/.ssh (e.g., ubuntu)
user-script user-script Executed each boot
user-data legacy-user-data
cloud-init:user-data user-data Evaluated by cloud-init once at VM creation only
iptables_disable iptables_disable ?
motd_sys_info motd_sys_info ?
sdc:datacenter_name availability_zone ?
sdc:vendor-data vendor-data ?
sdc:operator-script operator-script ?

source: https://github.com/number5/cloud-init/blob/master/cloudinit/sources/DataSourceSmartOS.py

#Cloud init Cloudinit documentation

Ubuntu's help page on CloudInit gives an example of how to combine multiple types of data into a single MIME encoded payloud

There is some documentation about cloud-config directives in the cloud init documentation, but it is given in the form of examples and is incomplete.

There are additional examples of Cloud-config scripting in the Digitalocean documentation. Digitalocean cloud-config documentation 1 Digitalocean cloud-config documentation 2

Joyent's documentation on the official Ubuntu images clarifies some differences in initialization behavior between the official Canonical images and the Joyent images. It also clarifies that cloud-init:user-data will run ONCE at VM creation, while user-script will run at every boot.

@curiositycasualty
Copy link

Thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment