On my KVM hypervisor I would like to add a new VM with CentOS-7-x86_64-GenericCloud.qcow2 disk but with my custom cloudinit config to make sure that the new VM will start up with all users, correct hostname and network settings. I've tried to include my config with initrd-inject and extra-args in my virt-install however extra-args and initrd-inject only works with location and I'm using disk path.

My question is how I can use my qcow2 disk with OS and add to it cloudinit config?


Create two files named meta-data and user-data which contain the instance metadata and your cloud-config YAML respectively. If you have no metadata to provide, create an empty file.

Now, create an ISO image with the volume label cidata which contains these two files. For example:

genisoimage -output nocloud.iso -volid cidata -joliet -rock user-data meta-data

Finally, provide the ISO image to the virtual machine as a CD-ROM image. Instead of trying to read from the network, cloud-init will get the instance metadata and your configuration from the ISO image.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.