[pve-devel] HTTP API : Cloudinit

Dominik Csapak d.csapak at proxmox.com
Wed Mar 21 09:32:17 CET 2018


On 03/21/2018 09:01 AM, Mariusz Miodowski wrote:
> Hello,
> 
> I am looking for any information about  support for cloudinit in HTTP
> API in upcoming 5.2 release.
> 
> Where can I find some information about that?
> 
> I will be very grateful if somebody can share some information about
> that. Basically I need information about:
>   - what methods will be available by API
>   - what parameters will be available
> 
> 
> 


Hi,

general documentation is currently only in git
https://git.proxmox.com/?p=pve-docs.git;a=blob_plain;f=qm-cloud-init.adoc;hb=refs/heads/master

(when this is packaged, this will also be available on the wiki)

we added the options in the vm config files, the options currently 
available are:

name (used as hostname)
nameserver
searchdomain
ciuser (default cloud init user)
cipassword (password, will be hashed upon setting, this only works 
properly with cloudinit >= 17.1 afair)
citype (which type of configuration will be generated, e.g configdrive2 
or nocloud, if not set it depends on the os version)
ipconfigX (used for setting the ip address of interface netX)
sshkeys (newline seperated trusted ssh public keys)

those can be used the same way all other options are used

when you want to use it, you have to add a cloud init drive with the 
special syntax:

e.g.

qm set 100 -ide2 local:cloudinit

this creates a cloudinit drive on ide2
the image will be regenerated when the vm is started or the image is 
ejected and recreated with

qm set 100 -ide2 none
qm set 100 -ide2 local:cloudinit

(api calls are the same)

i tested here with ubuntu 17.10 cloud init image (the openstack one) and 
this works, did not get it to work with windows cloud init from 
cloudbase.it (i will test this again soon)

the only thing not really clear is how we generate instance-ids

currently it is the hash of the config, so a config change means a new
instance-id (which triggers things as ssh-host key generation etc.)

this was done because there was a bug that cloud init only set the
configs when the instance id was changed (which is now fixed i think)

so we probably will either use the vmid as instance id (or 
clustername-vmid or something similar)

or we make it also a config value, so that the user can set it
(has anyone a strong opinion on this?)

hope this helps




More information about the pve-devel mailing list