Hi - ansible with libvirt(kvm) hosts deployments

hello all,

I’m working with many virsh VM (libvirt), so ansible is very usefull to manage them & deploy applications & so on of course.

  • Currently I use jinja2 template over xml to be able to import vm profile, this step is ok from shell (maybe it can be done from ansible ?but how ?)
  • the I build the VM from shell , this step would be done from ansible ? (currently seems not possible)
  • boot it with a kickstart or similar automatic installation of the OS. (currently seens not possible from ansible itself (not sure ansible has to be able to do that :slight_smile: )
  • setup the machine after it boots up - this step is ok with ansible as soon as the ssh key are setup

I’m looking since a while how to do the same thing with ansible

The main goal of that is to be able to deploy end to end the vm skelton, the vm OS & of course the applications I need all from one main.yaml (whatever the number of roles will be defined).
But here is what I’m looking for :
----How to define a kvm virtual macine from X yaml file(s) – let’s concentrate on this step (more important to me)

thanks
regards.

do you know about virsh ?

virsh create a32.xml??

Now, I’m not sure about if ansible has some kind of module ?

cheers!

XD

You can try the module “virt” (https://docs.ansible.com/ansible/devel/modules/virt_module.html).This.This) module was made to manage VMs using libvirt.

Thanks, I’m going to study & try it ; it seems to be the good solution for my needs :slight_smile: :slight_smile: