extract nested attribute from a href link with ansible ovirt_vm_facts

Hello I'd like to extract all vms which have the lease optionnal attribute and display the name of the storage domain of that lease. I managed to get that dict: "lease": { "storage_domain": { "href": "/ovirt-engine/api/storagedomains/0dc2941a-bdc2-4ce4-8ad7-43fa9c944f88", "id": "0dc2941a-bdc2-4ce4-8ad7-43fa9c944f88" } but how can I get the name of the storage instead of its id? thank you for your help -- Nathanaël Blanchet Supervision réseau Pôle Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr

Hello Nathanaël, On 11/27/18 10:08 AM, Nathanaël Blanchet wrote:
Hello
I'd like to extract all vms which have the lease optionnal attribute and display the name of the storage domain of that lease.
I managed to get that dict:
"lease": { "storage_domain": { "href": "/ovirt-engine/api/storagedomains/0dc2941a-bdc2-4ce4-8ad7-43fa9c944f88", "id": "0dc2941a-bdc2-4ce4-8ad7-43fa9c944f88" }
but how can I get the name of the storage instead of its id?
Unfortunately there is no way how to get the name directly in ovirt_vm_facts. Parameter fetch_nested works only for <link> API elements. But it is planned to add also this functionality. To be sure, I created RFE for it https://bugzilla.redhat.com/show_bug.cgi?id=1653743
thank you for your help
You can get the storage information with ovirt_storage_domain module (ovirt_storage_domain_facts can't search via id) - name: Test ovirt_storage_domain: auth: "{{ ovirt_auth }}" id: "b1d7018b-14b1-4766-b390-5a95974ec38b" register: mystorage Hopefully it helps. Best regards, Lucie -- Lucie Leistnerova Quality Engineer, QE Cloud, RHVM Red Hat EMEA IRC: lleistne @ #rhev-qe
participants (2)
-
Lucie Leistnerova
-
Nathanaël Blanchet