Closed LIV2 closed 3 months ago
Seems I must be wrong, using that path returns the same value for every host
Hi @LIV2 , Im actually working on updating the documentation. VMWare paths are super confusing, Im not sure why all datastores are listed under each host (even if the datastore isnt attached to that host)
Anyway, the correct path should be '/my_dc/datastore/ro_datastore'. Can you let me know if that helps?
That does work but I was trying to get the datastores for specific host(s) so I could rename the default datastore
I see. As far as I can tell, this is a limitation with the REST collection. It doesnt seem like the current lookup or (REST) host info module will return the info you want. The community vmware collection has a host info module, which does return just the datastores a host can access. In my testing, it showed the local datastores as well as any iscsi/network datastores that the host can access
---
- hosts: localhost
gather_facts: false
tasks:
- community.vmware.vmware_host_facts:
esxi_hostname: 'your_esxi_host'
validate_certs: false
- debug:
var: ansible_datastore
Output:
TASK [debug] ***********************************************************************************************************************************************************************************************************************************************
ok: [mikemorency] => {
"ansible_datastore": [
{
"free": "10.00 GB",
"name": "nfs-datastore",
"total": "20.00 GB"
},
{
"free": "300.00 GB",
"name": "datastore1",
"total": "700.00 GB"
},
{
"free": "1.00 TB",
"name": "iscsi-ds",
"total": "3.00 TB"
}
]
}
SUMMARY
The documentation for vmware.vmware_rest.datastore_moid has the following example
This returns nothing, I believe the correct path should be "/my_dc/datastore/my_cluster/esxi1.test/ro_datastore"
ISSUE TYPE
COMPONENT NAME
vmware.vmware_rest.datastore_moid
ANSIBLE VERSION
ansible [core 2.15.12] config file = /home/mharlum/.ansible.cfg configured module search path = ['/home/mharlum/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /home/mharlum/.pyenv/versions/3.9.18/lib/python3.9/site-packages/ansible ansible collection location = /home/mharlum/.ansible/collections:/usr/share/ansible/collections executable location = /home/mharlum/.pyenv/versions/3.9.18/bin/ansible python version = 3.9.18 (main, Mar 11 2024, 09:36:25) [GCC 13.2.1 20231205 (Red Hat 13.2.1-6)] (/home/mharlum/.pyenv/versions/3.9.18/bin/python3.9) jinja version = 3.1.4 libyaml = True