Open brotaxt opened 1 year ago
As already reported by @4ndyZ in issue148. The vmware.vmware_rest.vcenter_vm module is unable to handle vmware templates (without using a content library).
Tried the latest available version, the reported error still occurs.
- name: Gather Managed object ID (moid) from a template using the vSphere API output schema for REST Calls community.vmware.vmware_guest_info: hostname: "{{ vsphere_vcenter_hostname }}" username: "{{ vsphere_vcenter_username }}" password: "{{ vsphere_vcenter_password }}" validate_certs: no datacenter: "MYDATACENTER" # Hard coded name: "RedHat8" schema: "vsphere" properties: - _moId delegate_to: localhost register: moid_info - set_fact: template_moid: "{{ moid_info.instance.moid }}" - name: Create a VM vmware.vmware_rest.vcenter_vm: vcenter_hostname: "{{ vsphere_vcenter_hostname }}" vcenter_username: "{{ vsphere_vcenter_username }}" vcenter_password: "{{ vsphere_vcenter_password }}" vcenter_validate_certs: no name: "{{ inventory_hostname }}" state: "clone" source: "{{ template_moid }}" placement: cluster: '{{ my_cluster_info.id }}' datastore: '{{ my_datastore.datastore }}' folder: '{{ my_virtual_machine_folder.folder }}' resource_pool: "MYRESGROUP" # Hard coded hardware_version: VMX_19 cpu: hot_add_enabled: false count: "{{ vsphere_guest_cpus }}" memory: hot_add_enabled: true size_MiB: "{{ vsphere_memory }}" nics: - type: "VMXNET3" mac_type: "MANUAL" mac_address: "{{ vsphere_network[0].mac }}" backing: type: "DISTRIBUTED_PORTGROUP" network: "MYPORTGROUP" # Hard coded guest_OS: "RHEL_8_64" power_on: "yes" register: my_vm
"Virtual machine with identifier 'vm-MOID_HERE:UUID_HERE' does not exist.", "id": "com.vmware.api.vcenter.vm.not_found"
Indeed. The limitation is currently on the VMware REST API, which don't support it. The only way to do so is via SOAP using community.vmware modules.
community.vmware
As already reported by @4ndyZ in issue148. The vmware.vmware_rest.vcenter_vm module is unable to handle vmware templates (without using a content library).
Tried the latest available version, the reported error still occurs.