how to convert Template to VM

Hi all,

I tried to convert my template to a VM.
I created a playbook to do that but when I play the playbook it, It don’t work:

  • hosts: all
    gather_facts: false
    connection: local
    tasks:
  • name: Create a VM template
    vmware_guest: hostname=192.168.0.1 username=usernme password=password validate_certs=no datacenter=‘Datacenter’ esxi_hostname=‘esx’ name=‘VM’ is_template=no

I wonder if this is possible. Do you have any idea ?

Best regards,

Hello,

It is possible.
Seems that you are missing a few parameters

Here is an example of task that can work: (the

tasks:

  • name: Create VM from template
    vmware_guest:
    hostname: “{{vcenter_IP}}”
    username: “{{vcenter_user}}”
    password: “{{vcenter_pass}}”
    validate_certs: no
    datacenter: “{{vcenter_datacenter}}”
    cluster: “{{vcenter_cluster}}”
    resource_pool: “{{ vcenter_resource_pool }}”

folder: “{{folder}}”
name: “{{hostname}}”
state: poweredoff
template: “{{template}}”
hardware:
memory_mb: “{{ram}}”
num_cpus: “{{vcpu}}”

What are the error messages you have ?

Sorry, I didn’t understand properly.

You want to convert a template to a VM.
Can’t do that with vmware_guest.

To do that, I’m using a Powercli script executed by Ansible.