Skip to content
Harry Fike edited this page Apr 2, 2019 · 10 revisions

Using templates

Templates are simple json files that pre-define many of the options that are available via the command line, as well as some additional settings that may be of use for automation and version control.

The template format is as follows:

{
    "source_dmg": "/path/to/dmg",
    "output_dir": "/path/to/output/dir",
    "output_name": "custom-name",
    "cache": false,
    "hw_version": 11,
    "mem_size": 2048,
    "disk_type": 0,
    "bridged": false,
    "mac_address": "",
    "enable3d": false,
    "vnc_port": 5901,
    "vnc_passwd": "",
    "hw_model": "",
    "serial_number": "",
    "snapshot": true,
    "snapshot_name": "custom-name",
    "shared_folder": "/path/to/shared/folder",
    "packer_template": "packer-template.json",
    "fusion_path": "/path/to/VMware Fusion.app"
}

If you are using an http resource for the source dmg and cache is true, vfuse will cache the dmg in ~/.vfuse/ and will consult that directory before downloading the dmg again.

See VMware's documentation for more information on the hw_version setting. If you are planning to use your VM with ESXi 5.5, you will want to set the hw_version to 10.

disk_type is in reference to the disk types supported by VMware Fusion. Type 0 is the default, and will result in a growable virtual disk. Given that uing the -e or --esx command line argument changes disk_type to type 4 resulting in a preallocated ESX-type virtual disk, one could simply put 4 in a template to achieve the same result.

Disk type options are as follows:

0: single growable virtual disk
1: growable virtual disk split in 2GB files
2: preallocated virtual disk
3: preallocated virtual disk split in 2GB files
4: preallocated ESX-type virtual disk
5: compressed disk optimized for streaming
6: thin provisioned virtual disk - ESX 3.x and above

bridged defines whether the VM will be using a private (NAT) or a public (Bridged) network. Change the setting to true if you wish, for instance, for your VM to receive an IP from your org's dhcp server.

mac_address defines the MAC of en0. This might allow testing for DEP workflows.

enable3d defines whether you want 3D Graphics Acceleration. Note that VMware does not support 3D acceleration in 10.10.

vnc_port and vnc_passwd define whether to enable VNC access to your VM. You generate the vnc_passwd with the included vncpasswd.py script, which will encode the password to meet VMware's standard. With these set, you can connect to your VM at vnc://IPADDRESS:PORT (for example, vnc://localhost:5901).

hw_model defines the hardware model, allowing you to emulate a specific model. Rich Trouton has a great write-up on this.

serial_number defines the serial of the system, allowing testing of workflows that are based around specific serials.

shared_folder defines the directory Fusion will use as its shared folder. Note: VMware Fusion Tools must be installed to utilize shared folders.

packer_template will create or update a given packer-template.json file. If you are using the template from the repo, only the source_path variable will be updated, otherwise a new generic template file will be generated.

Clone this wiki locally