how to convert Template to VM

23 views
Skip to first unread message

olivier pouilly

unread,
Mar 18, 2018, 6:48:25 AM3/18/18
to Ansible Project
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,

Sebastien Desbois

unread,
Mar 20, 2018, 12:13:42 PM3/20/18
to Ansible Project
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 ?

Sebastien Desbois

unread,
Mar 20, 2018, 12:16:55 PM3/20/18
to Ansible Project
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.
Reply all
Reply to author
Forward
0 new messages