On 02.05.19 13:14, Jean-Yves LENHOF wrote:
>> and the result is:
>>
>> ok: [host1] => {
>> "msg": {
>> "0": {
>>     "backing_datastore": "datastore1",
[...]
>> },
>> "1": {
>>     "backing_datastore": "datastore1",
[...]
>> }
>>     }
>> }
>>
>> Good, i need second ("1") hard disk info, but when im use variable
>> disk_facts.guest_disk_facts.1 the result is:
>>
>> fatal: [host1]: FAILED! => {"msg": "The task includes an option with
>> an undefined variable. The error was: dict object has no element
>> 1\n\nThe error 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
>> problem.\n\nThe offending line appears to be:\n\n\n    - debug:\n     
>> ^ here\n"}
>>
>> What I do?
> 
> 
> Hi,
> 
> Try with disk_facts.guest_disk_facts[1]instead...

disk_facts.guest_disk_facts.1 and disk_facts.guest_disk_facts[1]

both expect disk_facts.guest_disk_facts to be a list, but it's a dict.

You'll need disk_facts.guest_disk_facts['1']

Notice the ''.

Sebastian

-- 
Sebastian Meyer
Linux Consultant & Trainer
Mail: [email protected]

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

-- 
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/83b66866-98db-9691-c4f6-6a917b75e763%40b1-systems.de.
For more options, visit https://groups.google.com/d/optout.

Reply via email to