[ovirt-users] Ansible Modules for ovirt
Jean Paul Gatt
jeanpaul.gatt at gamesysnetwork.com
Fri Nov 25 15:27:31 UTC 2016
Hi,
I have been trying to use the following ansible modules (based on the last devel commit in the ansible github repo for the extras modules 43bb97bc3763b0335e245606eb2985314902cc91):
* ovirt_vms
* ovirt_disks
I have had varying degrees of success, and I would like to list the following issues:
* Through the REST API, I can define multiple nic card configurations for cloud-init, however only 1 can be done with Ansible. Also, when using templates, it automatically assumes I will be using the last version of the template, this had to be defined when using REST.
* Assume I have deployed from a template. This will create a VM with a disk that is already attached. Now, let's say I want to confirm, or add more disks to the VM. If I pass a number of disks, that have already been attached, and I reference them by name (in ovirt_disks), I get an error. If I do the same operation by ID it seems to work. However I cannot get the ID when running ansible, I need to get it from REST. When I query ovirt_vms, disk attachments comes up as
o "disk_attachments": [],
If that field gets populated, I could then in turn run ovirt_disks with the ID, after querying the VM to get the attachments, but as it is it cannot be done.
I'll give an example
- name: Get Disks
ovirt_disks:
auth: "{{ovirt_auth}}"
vm_name: "{{item.0.name}}"
name: "{{item.1.name}}"
interface: "{{item.1.interface}}"
register: r_disks
with_subelements:
- "{{virtual_machines }}"
- drives
If the drives have already been attached this will fail... but
- name: Add Disks to VMs
ovirt_disks:
auth: "{{ovirt_auth}}"
vm_name: "{{item.0.name}}"
id: 8fc2811e-7774-4903-a5b3-489fdedb377b
size: "100GiB"
format: "{{item.1.format}}"
storage_domain: "{{item.1.storage_domain.name}}"
bootable: "{{item.1.bootable}}"
interface: "{{item.1.interface}}"
state: attached
with_subelements:
- "{{virtual_machines }}"
- drives
The second example is working, even if the disk has already been attached.
I'm assuming that since I'm creating the VM from a template, there might be multiple disks with the same name, and the wrong ID is being retrieved.
I'm happy to do more testing as further commits appear.
Regards,
Jean Paul Gatt
This email (including any attachments) is confidential, protected by copyright and/or other intellectual property rights and may be privileged. If you have received it in error, please notify the sender immediately before deleting the email from your device. Do not use, copy or disclose the information contained in this message or in any attachment. We accept no responsibility for malware that we may have unintentionally transmitted to you within this email. Those communicating with us by email will be deemed to have consented to us intercepting and monitoring those communications. Gamesys Network Ltd is registered in Malta, with company registration number C47555 and VAT registered number MT19542837. The registered office is at Capital Business Centre, Entrance A, Level 1, Taz-Zwejt Street, San Gwann SGN3000.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20161125/e2a0ae3a/attachment-0001.html>
More information about the Users
mailing list