Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to clone vmware template #453

Open
brotaxt opened this issue Nov 24, 2023 · 1 comment
Open

Unable to clone vmware template #453

brotaxt opened this issue Nov 24, 2023 · 1 comment
Labels
blocked Used when issue is blocked by so other issue

Comments

@brotaxt
Copy link

brotaxt commented Nov 24, 2023

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"
@machacekondra
Copy link

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.

@machacekondra machacekondra added the blocked Used when issue is blocked by so other issue label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Used when issue is blocked by so other issue
Projects
None yet
Development

No branches or pull requests

2 participants