» Configuration

While Vagrant VMware Desktop provider is a drop-in replacement for VirtualBox, thereare some additional features that are exposed that allow you to more finelyconfigure VMware-specific aspects of your machines.

Configuration settings for the provider are set in the Vagrantfile:

  1. Vagrant.configure("2") do |config|
  2. config.vm.box = "my-box"
  3. config.vm.provider "vmware_desktop" do |v|
  4. v.gui = true
  5. end
  6. end

» Provider settings

  • clone_directory (string) - Path for storing VMware clones. This value canalso be set using the VAGRANT_VMWARE_CLONE_DIRECTORY environment variable.This defaults to ./.vagrant
  • enable_vmrun_ip_lookup (bool) - Use vmrun to discover guest IP address.This defaults to true
  • functional_hgfs (bool) - HGFS is functional within the guest.This defaults to detected capability of the guest
  • unmount_default_hgfs (bool) - Unmount the default HGFS mount point within the guest.This defaults to false
  • gui (bool) - Launch guest with a GUI.This defaults to false
  • ssh_info_public (bool) - Use the public IP address for SSH connections to guest.This defaults to false
  • verify_vmnet (bool) - Verify vmnet devices health before usage.This defaults to true
  • linked_clone (bool) - Use linked clones instead of full copy clones.This defaults to true
  • vmx (hash) - VMX key/value pairs to set or unset. If the value is nil, the key willbe deleted.
  • whitelist_verified (bool, symbol) - Flag that VMware box has been properly configuredfor whitelisted VMX settings. true if verified, false if unverified, :disable_warningto silence whitelist warnings.
  • port_forward_network_pause - Number of seconds to pause after applying port forwardingconfiguration. This allows guest time to acquire DHCP address if previous address isdropped when VMware network services are restarted.This defaults to 0
  • utility_port (integer) - Listen port of the Vagrant VMware Utility service.This defaults to 9922
  • utility_certificate_path (string) - Path to the Vagrant VMware Utility servicecertificates directory.The default value is dependent on the host

» VM Clone Directory

By default, the VMware provider will clone the VMware VM in the boxto the ".vagrant" folder relative to the folder where the Vagrantfile is.Usually, this is fine. For some people, for example those who use adifferential backup software such as Time Machine, this is very annoyingbecause you cannot regularly ignore giant virtual machines as part of backups.

The directory where the provider clones the virtual machine can becustomized by setting the VAGRANT_VMWARE_CLONE_DIRECTORY environmentalvariable. This does not need to be unique per project. Each project willget a different sub-directory within this folder. Therefore, it is safe toset this systemwide.

» Linked Clones

By default new machines are created using a linked clone to the basebox. This reduces the time and required disk space incurred by directlyimporting the base box.

Linked clones are based on a master VM, which is generated by importing thebase box only once the first time it is required. For the linked clones onlydifferencing disk images are created where the parent disk image belongs tothe master VM. To disable linked clones:

  1. config.vm.provider "vmware_desktop" do |v|
  2. v.linked_clone = false
  3. end

» VMX Customization

If you want to add or remove specific keys from the VMX file, you can dothat:

  1. config.vm.provider "vmware_desktop" do |v|
  2. v.vmx["custom-key"] = "value"
  3. v.vmx["another-key"] = nil
  4. end

In the example above, the "custom-key" key will be set to "value" and the"another-key" key will be removed from the VMX file.

VMX customization is done as the final step before the VMware machine isbooted, so you have the ability to possibly undo or misconfigure thingsthat Vagrant has set up itself.

VMX is an undocumented format and there is no official reference forthe available keys and values. This customization option is exposed forpeople who have knowledge of exactly what they want.

The most common keys people look for are setting memory and CPUs.The example below sets both:

  1. config.vm.provider "vmware_desktop" do |v|
  2. v.vmx["memsize"] = "1024"
  3. v.vmx["numvcpus"] = "2"
  4. end