First I will admit that I am not an exprt on VMWare ESXi. And facing issue while automating launch of preconfigured servers using Ansible.
I want to launch a VM using template in VMWare ESXi server 5. I have created a template from an existing VM (.ova file). And now I am trying to launch it using Ansible VMWare_guest module. What I find confusing is the part where you provide path to the template file. Wouldn’t it be easier to launch if template is stored in datastore!?
My Ansible task as follows, which gets a VM up & running for me with CentOS 7ISO file loaded then I proceed to install CentOS manually by taking console access of VM.
- vsphere_guest:
vcenter_hostname: 172.xxx.x.xxx
username: xxxx
password: xxxxxx
guest: test-1
state: powered_on
force: yes
vm_disk:
disk1:
size_gb: 50
type: thin
datastore: datastore1
vm_nic:
nic1:
type: vmxnet3
network: VM Network
network_type: standard
vm_hardware:
memory_mb: 4096
num_cpus: 2
osid: centos64Guest
scsi: paravirtual
vm_cdrom:
type: iso
iso_path: “datastore1/CentOS_iso/CentOS-7-x86_64-Everything.iso”
state: reconfigured
esxi:
datacenter: ha-datacenter
hostname: “172”
What I want to achieve is to launch a VM with preinstalled OS & Preconfigured hardware configuration. I have wrote another ansible task for this which will use template to achieve this feat.