Hi, i'm use this playbook

---
- hosts: host1
  gather_facts: false
  connection: local

  tasks:
    - name: Gather fact datastore
      vmware_datastore_facts:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        datacenter: Datacenter
        validate_certs: no
      delegate_to: localhost
      register: datastore_guest

    - debug:
        msg: "{{datastore_guest.datastores}}"
...

and the result is this:

ok: [host1] => {
    "msg": [
        {
            "accessible": true,
            "capacity": 492042190848,
            "datastore_cluster": "N/A",
            "freeSpace": 243600982016,
            "maintenanceMode": "normal",
            "multipleHostAccess": false,
            "name": "datastore1",
            "provisioned": 513138893836,
            "type": "VMFS",
            "uncommitted": 264697685004,
            "url": "ds:///vmfs/volumes/5b924bfa-d16b145b-f2fe-dc4a3e868907/"
        }
    ]
}

ok. I want the other result. In only want freeSpace part, but when im use 
datastore_guest.datastores.freeSpace variable the result is:

fatal: [host1]: FAILED! => {"msg": "The task includes an option with an 
undefine                                                                    
         d variable. The error was: 'list object' has no attribute 
'freeSpace'\n\nThe err                                                      
                       or appears to have been in 
'/root/playbook/operations/ListVMvalues.yml': line 50                      
                                                       , column 7, but 
may\nbe elsewhere in the file depending on the exact syntax prob            
                                                                
 lem.\n\nThe offending line appears to be:\n\n\n    - debug:\n      ^ 
here\n"}

What i do it?


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d585d2a1-2cf1-49cb-ab0f-b027e4231c4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to