This is the code for the vmware_guest_facts playbook that can't find the VM:

- name: Gather Facts about the VMs
>   hosts: modify
>   gather_facts: False
>   connection: local
>   vars_files:
>   - group_vars/vault/lab_credentials.yml
>   tasks:
>   - name: gather the VM facts
>     vmware_guest_facts:
>       validate_certs: False
>       datacenter: "{{ vcenter_datacenter }}"
>       hostname: "{{ vcenter_hostname }}"
>       username: "{{ vcenter_user }}"
>       password: "{{ vcenter_passwd }}"
>       name: "{{ guest_name }}"
>       # name: ansclient111
>       # uuid: 502fa037-6612-a282-a2c7-0f08bd17f75b
>     register: facts




On Wednesday, April 5, 2017 at 11:26:21 AM UTC-4, Diego Puertas wrote:
>
> If I give it the datacenter, then it complaints about: "msg": "Unable to 
> gather facts for non-existing VM ansclient111"
>
> However, if I try with vsphere_guest, it works:
>
>>
>> - name: gather vm facts
>>   hosts: modify
>>   gather_facts: False
>>   connection: local
>>   vars_files:
>>   - group_vars/vault/lab_credentials.yml
>>   tasks:
>>   - name: Getting some Facts
>>     vsphere_guest:
>>           vcenter_hostname: "{{ vcenter_hostname }}"
>>           username: "{{ vcenter_user }}"
>>           password: "{{ vcenter_passwd }}"
>>           guest: "{{ guest_name }}"
>>           vmware_guest_facts: true
>>           validate_certs: no
>>     register: vmguest_facts
>>     tags: vmfacts
>>   - name: debug facts
>>     debug: msg="vmguest facts are {{ vmguest_facts }}"
>>     tags: vmfacts
>
>
>
>
> On Wednesday, April 5, 2017 at 11:21:55 AM UTC-4, Kai Stian Olstad wrote:
>>
>> On 05. april 2017 17:12, Diego Puertas wrote: 
>> > OK, now I'm using the vmware_guest_facts module, which seems to be the 
>> way 
>> > to gather facts now. I'm using the exact same syntax as the example, 
>> still 
>> > doesn't work, Ansible asks me for the datacenter name, which is not 
>> > included in the example: 
>>
>> https://docs.ansible.com/ansible/vmware_guest_facts_module.html#options 
>> say datacenter is required, so probably error in the example. 
>> So just add it and see if it works. 
>>
>>
>> -- 
>> Kai Stian Olstad 
>>
>

-- 
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/6c3d733e-491e-4358-9c8f-85c2ceb0cf63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to