Ansible example for creating VM from qcow2 image?

Hello there, anyone Ansible examples on how to create a VM (including cloud init) from a previously uploaded qcow2 file (using the ovirt_vm module from https://docs.ansible.com/ansible/latest/modules/ovirt_vm_module.html#ovirt-v... I simply cannot wrap my head around it. Do you create a disk from the qcow2 and attach it to the VM? Or do you mount it as ISO in CDROM of the VM and the automate the installation? What are the exact steps? Do I have to use templates (I don't want to)? Kind regards Skrzetuski

Hello, creating a VM with QCOW2 disk is as easy as that. The only requirement to run this is having QCOW2 disk named "centos7" in your engine: --- - hosts: localhost gather_facts: false tasks: - name: Obtain SSO token ovirt_auth: url: https://<engine_fqdn>/ovirt-engine/api username: admin@internal password: <pass> - name: Create a VM with QCOW2 disk ovirt_vm: auth: "{{ ovirt_auth }}" state: present cluster: Default name: jzmeskal_centos7 disks: - name: centos7 bootable: True Now if you'd like to use cloud-init, that's a different story and you probably won't get around using templates. From the Ansible point of view, it's quite easy - you just use *cloud_init* key of *ovirt_vm* module. However for that to work, your VM has to be either created with a disk that has *cloud-init *package installed or created from a template that is cloud-init enabled. See my response from December here <https://lists.ovirt.org/archives/list/users@ovirt.org/message/VD2DREZYMDY2NE5LKNS6OBFE36PC66R7/> . Another user was interested in pretty much the same topic. Hope this helps! Jan On Sun, Jan 5, 2020 at 3:05 AM <m.skrzetuski@gmail.com> wrote:
Hello there,
anyone Ansible examples on how to create a VM (including cloud init) from a previously uploaded qcow2 file (using the ovirt_vm module from https://docs.ansible.com/ansible/latest/modules/ovirt_vm_module.html#ovirt-v... )?
I simply cannot wrap my head around it.
Do you create a disk from the qcow2 and attach it to the VM? Or do you mount it as ISO in CDROM of the VM and the automate the installation? What are the exact steps? Do I have to use templates (I don't want to)?
Kind regards Skrzetuski _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/site/privacy-policy/ oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/D6H2MKGO7VNCNK...
-- Jan Zmeskal Quality Engineer, RHV Core System Red Hat <https://www.redhat.com> <https://www.redhat.com>
participants (2)
-
Jan Zmeskal
-
m.skrzetuski@gmail.com