Re: cloud-init libvirt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/13/20 4:05 PM, PunkGeek wrote:
is there any way to use cloud-init configs in python libvirt?
 cloud-init require to create an iso, which seems that ovirt support cloud-config: https://red.ht/2K1gBkn
 But how can I do that by python libvirt?

I know I can mount iso by python libvirt to the VM, but the process of creating iso file is the problem which if it is possible to enter the cloud-config commands by libvirt could be better to me.
Regards

The short answer is yes.
I have put together an ansible role to build cloud init based qcow images and does the most basic of configs based on the vars passed to the role.

you need to create an ISO with 2 files: "meta-data" and "user-data"

then run something like the folowing command to create the ISO.
        genisoimage -output myvmconfig.iso -volid cidata -joliet -r cloudinit_src_dir/

Then you create and start your VM with the ISO attached.
On the first reboot of the VM you could remove the ISO so long as cloud-init is not going to run again.

My work was done using ansible and the standard virsh commands so your build process will be different


--
Alvin Starr                   ||   land:  (647)478-6285
Netvel Inc.                   ||   Cell:  (416)806-0133
alvin@xxxxxxxxxx              ||






[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux