Re: [ansible-project] i can't list hard disk info

2019-05-02 Thread lander7500
oooh goood. THANK YOU VERY MUCH <3

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3a5f1531-712b-47ce-a350-58294257d8a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] i can't list hard disk info

2019-05-02 Thread Sebastian Meyer
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: me...@b1-systems.de

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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
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.


Re: [ansible-project] i can't list hard disk info

2019-05-02 Thread lander7500
When i'm use 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"}


-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b75fab50-cd10-483e-a32c-f1fcf6878ce4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] i can't list hard disk info

2019-05-02 Thread Jean-Yves LENHOF


Le 02/05/2019 à 09:02, lander7...@gmail.com a écrit :

Hi, i use this playbook:

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

tasks:

- name: Gather disk facts from virtual machine using name
  vmware_guest_disk_facts:
    # Unirse a vsphere
    hostname: "{{ hostname }}"
    username: "{{ username }}"
    password: "{{ password }}"
    datacenter: Datacenter
    # Para pasar por el SSH sin autenticar nada
    validate_certs: no
    # Nombre de la maquina
    name: "{{vm}}"
  delegate_to: localhost
  # Lo metemos en una variable
  register: disk_facts

- debug:
    msg: "{{disk_facts.guest_disk_facts}}"
...

and the result is:

ok: [host1] => {
"msg": {
"0": {
    "backing_datastore": "datastore1",
    "backing_disk_mode": "persistent",
    "backing_eagerlyscrub": false,
    "backing_filename": "[datastore1] 
ANSIBLE_Centos/ANSIBLE_Centos-03.vmdk",

    "backing_thinprovisioned": false,
    "backing_writethrough": false,
    "capacity_in_bytes": 17179869184,
    "capacity_in_kb": 16777216,
    "controller_key": 1000,
    "key": 2000,
    "label": "Hard disk 1",
    "summary": "16,777,216 KB",
    "unit_number": 0
},
"1": {
    "backing_datastore": "datastore1",
    "backing_disk_mode": "persistent",
    "backing_eagerlyscrub": false,
    "backing_filename": "[datastore1] 
ANSIBLE_Centos/ANSIBLE_Centos_3.vmdk",

    "backing_thinprovisioned": false,
    "backing_writethrough": false,
    "capacity_in_bytes": 2147483648,
    "capacity_in_kb": 2097152,
    "controller_key": 1000,
    "key": 2001,
    "label": "Hard disk 2",
    "summary": "2,097,152 KB",
    "unit_number": 1
}
    }
}

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...

Regards,


JYL



--
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 ansible-project+unsubscr...@googlegroups.com 
.
To post to this group, send email to ansible-project@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/56c12ea3-45ea-4382-8bea-b5bd4dd86662%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/67fcf47a-0abd-1d19-02a3-c1d083fd3ea1%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] i can't list hard disk info

2019-05-02 Thread lander7500
Hi, i use this playbook:

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

  tasks:

- name: Gather disk facts from virtual machine using name
  vmware_guest_disk_facts:
# Unirse a vsphere
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
datacenter: Datacenter
# Para pasar por el SSH sin autenticar nada
validate_certs: no
# Nombre de la maquina
name: "{{vm}}"
  delegate_to: localhost
  # Lo metemos en una variable
  register: disk_facts

- debug:
msg: "{{disk_facts.guest_disk_facts}}"
...

and the result is:

ok: [host1] => {
"msg": {
"0": {
"backing_datastore": "datastore1",
"backing_disk_mode": "persistent",
"backing_eagerlyscrub": false,
"backing_filename": "[datastore1] 
ANSIBLE_Centos/ANSIBLE_Centos-03.vmdk",
"backing_thinprovisioned": false,
"backing_writethrough": false,
"capacity_in_bytes": 17179869184,
"capacity_in_kb": 16777216,
"controller_key": 1000,
"key": 2000,
"label": "Hard disk 1",
"summary": "16,777,216 KB",
"unit_number": 0
},
"1": {
"backing_datastore": "datastore1",
"backing_disk_mode": "persistent",
"backing_eagerlyscrub": false,
"backing_filename": "[datastore1] 
ANSIBLE_Centos/ANSIBLE_Centos_3.vmdk",
"backing_thinprovisioned": false,
"backing_writethrough": false,
"capacity_in_bytes": 2147483648,
"capacity_in_kb": 2097152,
"controller_key": 1000,
"key": 2001,
"label": "Hard disk 2",
"summary": "2,097,152 KB",
"unit_number": 1
}
}
}

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?

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/56c12ea3-45ea-4382-8bea-b5bd4dd86662%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.