0

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?

netmat
  • 61
  • 2
  • 4

1 Answers1

0

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.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972