# how to convert Template to VM

**URL:** <https://forum.ansible.com/t/how-to-convert-template-to-vm/27031>\
**Category:** Ansible Project\
**Created:** [March 18, 2018, 10:48am UTC](https://forum.ansible.com/t/how-to-convert-template-to-vm/27031 "2018-03-18T10:48:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![olivier\_pouilly](https://avatars.discourse-cdn.com/v4/letter/o/f19dbf/32.png) [@olivier\_pouilly](https://forum.ansible.com/u/olivier_pouilly)\
**Post date:** [March 18, 2018, 10:48am UTC](https://forum.ansible.com/t/how-to-convert-template-to-vm/27031/1 "2018-03-18T10:48:25Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![Sebastien\_Desbois](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@Sebastien\_Desbois](https://forum.ansible.com/u/Sebastien_Desbois)\
**Post date:** [March 20, 2018, 4:13pm UTC](https://forum.ansible.com/t/how-to-convert-template-to-vm/27031/2 "2018-03-20T16:13:42Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Sebastien\_Desbois](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@Sebastien\_Desbois](https://forum.ansible.com/u/Sebastien_Desbois)\
**Post date:** [March 20, 2018, 4:16pm UTC](https://forum.ansible.com/t/how-to-convert-template-to-vm/27031/3 "2018-03-20T16:16:55Z")

</div>

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.
