Hello,

I did some tests  with your snippet.
This is not working and it's normal.

Either you create the VM based on a template, and the result will be by 
default in the same datastore as the the template, or you create a VM from 
scratch and you specifu the disk parameters (size, 
type, autoselect_datastore: true if you don't want to specify the 
datastore) and all other required parameters.
This is very strange because you are getting the "*Failed to find a matching 
datastore" 
*message first when you are missing 50 to 60% of the parameters needed to 
create a VM from scratch.

Either fill the template parameter or all the necessary parameters.

Regards,



Le jeudi 28 septembre 2017 21:08:44 UTC+2, Vijay Misra a écrit :
>
> Thanks for your response !
>
> I checked and Yes I do have enough space on my datastore.
>
> -Vijay
>
> On Thursday, September 28, 2017 at 8:23:22 AM UTC-7, Sebastien Desbois 
> wrote:
>>
>> Hello,
>>
>> when you don't specify a datastore, ansible will use an autoselect_datastore 
>> function to find a datastore for your VM.
>> In this function, there is a check to see if there is enough space in the 
>> datastores list for your new VM.
>> If not, no datastore is return by this function and you get the "*Failed to 
>> find a matching datastore" 
>> message.*
>>
>> I think you need to check first if you have enough space in your 
>> datastores to host this new VM.
>>
>>
>>
>> Le jeudi 28 septembre 2017 03:44:32 UTC+2, Vijay Misra a écrit :
>>>
>>> Hi , 
>>>  
>>>  I have upgraded to ansible 2.4 and using vmware_guest module to create 
>>> a VM. I am getting "Failed to find a matching datastore".
>>> same code works fine in ansiblke 2.3.
>>>
>>> is this a known issue or am i missing something?
>>>
>>> Thanks,
>>> Vijay
>>>
>>>
>>>
>>>
>>>   msg": "Failed to find a matching datastore"
>>>
>>> Here is my ansible snippet:
>>>
>>>   *  - name: Create a virtual machine from the datastore VM ( Using 
>>> vGPU VM)*
>>> *        local_action:*
>>> *           module: vmware_guest*
>>> *           hostname: '{{ hostname }}'*
>>> *           username: '{{ username }}'*
>>> *           password: '{{ password }}'*
>>> *           name: '{{ guest_name}}'*
>>> *           esxi_hostname:   '{{ esxi_hostname1 }}'*
>>> *#           template: ''*
>>> *           is_template: no*
>>> *           datacenter: '{{ datacenter_name }}'*
>>> *           state: poweredon*
>>> *           validate_certs: False*
>>> *        register: taskresult*
>>> *        ignore_errors: True*
>>>
>>> when i run with -vvvv option i see following parameters are passed:
>>>
>>> *fatal: [xxxxxxxx -> localhost]: FAILED! => {*
>>> *    "changed": false, *
>>> *    "failed": true, *
>>> *    "invocation": {*
>>> *        "module_args": {*
>>> *            "annotation": null, *
>>> *            "cluster": null, *
>>> *            "customization": {}, *
>>> *            "customvalues": [], *
>>> *            "datacenter": "Datacenter", *
>>> *            "disk": [], *
>>> *            "esxi_hostname": "10..x.x.x", *
>>> *            "folder": "/vm", *
>>> *            "force": false, *
>>> *            "guest_id": null, *
>>> *            "hardware": {}, *
>>> *            "hostname": "10.x.x.x", *
>>> *            "is_template": false, *
>>> *            "name": "myvgpu_clone2", *
>>> *            "name_match": "first", *
>>> *            "networks": [], *
>>> *            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", *
>>> *            "resource_pool": null, *
>>> *            "state": "poweredon", *
>>> *            "template_src": null, *
>>> *            "username": "administrator@vsphere.local", *
>>> *            "uuid": null, *
>>> *            "validate_certs": false, *
>>> *            "wait_for_ip_address": false*
>>> *        }*
>>> *    }, *
>>> *    "msg": "Failed to find a matching datastore"*
>>> *}*
>>> *...ignoring*
>>>
>>>
>>> I would appreciate your help if you could please help me in resolving 
>>> this issue.
>>>
>>

-- 
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/987568be-eea3-46ec-a772-06c44d8e8cb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to