add support for cloud-init drive as created by libvirt_cloudinit_disk
See original GitHub issueI would like to use the cloud-init disk generated by https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/website/docs/r/cloudinit.html.markdown. I have an ubuntu regular cloud-init example usage at https://github.com/rgl/terraform-libvirt-ubuntu-example which I’m trying to port to windows.
Essentially, terraform-provider-libvirt creates a iso which is attached as a cd-rom to the VM. The cd-rom label is cidata
and the root directory has the following files:
- meta-data
- network-config
- user-data
As displayed by Windows Explorer:
I’ve tried to follow the cloudbase-init codebase and ended up at https://github.com/cloudbase/cloudbase-init/blob/cd8eca0f91aed04690ed7272485185ab6a1a8e18/cloudbaseinit/metadata/services/osconfigdrive/windows.py#L55-L58 which checks for the label and some files. Is this the best place to add support for the cloud-init? or is it better to create an entire new metadata service class?
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (11 by maintainers)
On another topic, you can easily generate custom Windows images using https://github.com/cloudbase/windows-openstack-imaging-tools/, with support for custom cloudbase-init config files, custom installers and much more.
Cloudbase-init works on a plugin based framework. Available plugin docs: https://cloudbase-init.readthedocs.io/en/latest/plugins.html
As for the cloud-config example, cloudbase-init supports only setting timezone, hostname and write_file: https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config
Your requirements:
Automatically expand the root disk if there is space available. – plugin available: https://cloudbase-init.readthedocs.io/en/latest/plugins.html#volume-expanding-main
Change a user password: available for more advanced services, your options using config drive are limited to creating a cmd/powershell userdata that does that. For this feature there is (again) an older patch that adds cloud-config support, which you can use: https://review.opendev.org/#/c/379354/
Format and initialize disks: not implemented, but you can fallback to the aforementioned userdata
Set IP configuration: not supported for NoCloudConfigDrive, you need to implement the network metadata parsing, as the plugin exists. For example, the config drive implementation: https://github.com/cloudbase/cloudbase-init/blob/master/cloudbaseinit/metadata/services/baseopenstackservice.py#L240 You need to implement for the NoCloudConfigDrive metadata service the get_network_details or get_network_details _v2 method.
Run commands: localscripts plugin or userdata.
Keep in mind that the userdata can be in MIME format: https://cloudbase-init.readthedocs.io/en/latest/userdata.html#multi-part-content