Building the VMX template

We are now going to create the template file that we will use to build our virtual machine in Python. Here's an example of the final running VMX file that we need to generate with the help of Python and Jinja2:

.encoding = "UTF-8"vhv.enable = "TRUE"config.version = "8"virtualHW.version = "8"vmci0.present = "TRUE"hpet0.present = "TRUE"displayName = "test_jinja2"# SpecsmemSize = "4096"numvcpus = "1"cpuid.coresPerSocket = "1"# HDDscsi0.present = "TRUE"scsi0.virtualDev = "lsilogic"scsi0:0.deviceType = "scsi-hardDisk"scsi0:0.fileName = "test_jinja2.vmdk"scsi0:0.present = "TRUE"# Floppyfloppy0.present = "false"#  CDRomide1:0.present = "TRUE"ide1:0.deviceType = "cdrom-image"ide1:0.fileName = "/vmfs/volumes/datastore1/ISO ...

Get Hands-On Enterprise Automation with Python. now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.