github.com/StackPointCloud/packer@v0.10.2-0.20180716202532-b28098e0f79b/website/source/docs/builders/vmware-iso.html.md.erb (about) 1 --- 2 modeline: | 3 vim: set ft=pandoc: 4 description: | 5 This VMware Packer builder is able to create VMware virtual machines from an 6 ISO file as a source. It currently supports building virtual machines on hosts 7 running VMware Fusion for OS X, VMware Workstation for Linux and Windows, and 8 VMware Player on Linux. It can also build machines directly on VMware vSphere 9 Hypervisor using SSH as opposed to the vSphere API. 10 layout: docs 11 page_title: 'VMware ISO - Builders' 12 sidebar_current: 'docs-builders-vmware-iso' 13 --- 14 15 # VMware Builder (from ISO) 16 17 Type: `vmware-iso` 18 19 This VMware Packer builder is able to create VMware virtual machines from an ISO 20 file as a source. It currently supports building virtual machines on hosts 21 running [VMware Fusion](https://www.vmware.com/products/fusion/overview.html) for 22 OS X, [VMware 23 Workstation](https://www.vmware.com/products/workstation/overview.html) for Linux 24 and Windows, and [VMware Player](https://www.vmware.com/products/player/) on 25 Linux. It can also build machines directly on [VMware vSphere 26 Hypervisor](https://www.vmware.com/products/vsphere-hypervisor/) using SSH as 27 opposed to the vSphere API. 28 29 The builder builds a virtual machine by creating a new virtual machine from 30 scratch, booting it, installing an OS, provisioning software within the OS, then 31 shutting it down. The result of the VMware builder is a directory containing all 32 the files necessary to run the virtual machine. 33 34 ## Basic Example 35 36 Here is a basic example. This example is not functional. It will start the OS 37 installer but then fail because we don't provide the preseed file for Ubuntu to 38 self-install. Still, the example serves to show the basic configuration: 39 40 ``` json 41 { 42 "type": "vmware-iso", 43 "iso_url": "http://old-releases.ubuntu.com/releases/precise/ubuntu-12.04.2-server-amd64.iso", 44 "iso_checksum": "af5f788aee1b32c4b2634734309cc9e9", 45 "iso_checksum_type": "md5", 46 "ssh_username": "packer", 47 "ssh_password": "packer", 48 "shutdown_command": "shutdown -P now" 49 } 50 ``` 51 52 ## Configuration Reference 53 54 There are many configuration options available for the VMware builder. They are 55 organized below into two categories: required and optional. Within each 56 category, the available options are alphabetized and described. 57 58 In addition to the options listed here, a 59 [communicator](/docs/templates/communicator.html) can be configured for this 60 builder. 61 62 ### Required: 63 64 - `iso_checksum` (string) - The checksum for the OS ISO file. Because ISO 65 files are so large, this is required and Packer will verify it prior to 66 booting a virtual machine with the ISO attached. The type of the checksum is 67 specified with `iso_checksum_type`, documented below. At least one of 68 `iso_checksum` and `iso_checksum_url` must be defined. This has precedence 69 over `iso_checksum_url` type. 70 71 - `iso_checksum_type` (string) - The type of the checksum specified in 72 `iso_checksum`. Valid values are `none`, `md5`, `sha1`, `sha256`, or 73 `sha512` currently. While `none` will skip checksumming, this is not 74 recommended since ISO files are generally large and corruption does happen 75 from time to time. 76 77 - `iso_checksum_url` (string) - A URL to a GNU or BSD style checksum file 78 containing a checksum for the OS ISO file. At least one of `iso_checksum` 79 and `iso_checksum_url` must be defined. This will be ignored if 80 `iso_checksum` is non empty. 81 82 - `iso_url` (string) - A URL to the ISO containing the installation image. 83 This URL can be either an HTTP URL or a file URL (or path to a file). If 84 this is an HTTP URL, Packer will download it and cache it between runs. 85 86 ### Optional: 87 88 - `boot_command` (array of strings) - This is an array of commands to type 89 when the virtual machine is first booted. The goal of these commands should 90 be to type just enough to initialize the operating system installer. Special 91 keys can be typed as well, and are covered in the section below on the 92 boot command. If this is not specified, it is assumed the installer will 93 start itself. 94 95 - `boot_wait` (string) - The time to wait after booting the initial virtual 96 machine before typing the `boot_command`. The value of this should be 97 a duration. Examples are `5s` and `1m30s` which will cause Packer to wait 98 five seconds and one minute 30 seconds, respectively. If this isn't 99 specified, the default is `10s` or 10 seconds. 100 101 - `cdrom_adapter_type` (string) - The adapter type (or bus) that will be used 102 by the cdrom device. This is chosen by default based on the disk adapter 103 type. VMware tends to lean towards `ide` for the cdrom device unless 104 `sata` is chosen for the disk adapter and so Packer attempts to mirror 105 this logic. This field can be specified as either `ide`, `sata`, or `scsi`. 106 107 - `disable_vnc` (boolean) - Whether to create a VNC connection or not. 108 A `boot_command` cannot be used when this is `true`. Defaults to `false`. 109 110 - `disk_adapter_type` (string) - The adapter type of the VMware virtual disk 111 to create. This option is for advanced usage, modify only if you know what 112 you're doing. Some of the options you can specify are `ide`, `sata`, `nvme` 113 or `scsi` (which uses the "lsilogic" scsi interface by default). If you 114 specify another option, Packer will assume that you're specifying a `scsi` 115 interface of that specified type. For more information, please consult the 116 <a href="http://www.vmware.com/pdf/VirtualDiskManager.pdf" target="_blank" 117 rel="nofollow noopener noreferrer"> 118 Virtual Disk Manager User's Guide</a> for desktop VMware clients. 119 For ESXi, refer to the proper ESXi documentation. 120 121 - `disk_additional_size` (array of integers) - The size(s) of any additional 122 hard disks for the VM in megabytes. If this is not specified then the VM 123 will only contain a primary hard disk. The builder uses expandable, not 124 fixed-size virtual hard disks, so the actual file representing the disk will 125 not use the full size unless it is full. 126 127 - `disk_size` (number) - The size of the hard disk for the VM in megabytes. 128 The builder uses expandable, not fixed-size virtual hard disks, so the 129 actual file representing the disk will not use the full size unless it 130 is full. By default this is set to `40000` (about 40 GB). 131 132 - `disk_type_id` (string) - The type of VMware virtual disk to create. This 133 option is for advanced usage. 134 135 For desktop VMware clients: 136 137 Type ID | Description 138 --- | --- 139 `0` | Growable virtual disk contained in a single file (monolithic sparse). 140 `1` | Growable virtual disk split into 2GB files (split sparse). 141 `2` | Preallocated virtual disk contained in a single file (monolithic flat). 142 `3` | Preallocated virtual disk split into 2GB files (split flat). 143 `4` | Preallocated virtual disk compatible with ESX server (VMFS flat). 144 `5` | Compressed disk optimized for streaming. 145 146 The default is `1`. 147 148 For ESXi, this defaults to `zeroedthick`. The available options for ESXi 149 are: `zeroedthick`, `eagerzeroedthick`, `thin`, `rdm:dev`, `rdmp:dev`, 150 `2gbsparse`. 151 152 For more information, please consult the [Virtual Disk Manager User's 153 Guide](https://www.vmware.com/pdf/VirtualDiskManager.pdf) for desktop 154 VMware clients. For ESXi, refer to the proper ESXi documentation. 155 156 - `floppy_dirs` (array of strings) - A list of directories to place onto 157 the floppy disk recursively. This is similar to the `floppy_files` option 158 except that the directory structure is preserved. This is useful for when 159 your floppy disk includes drivers or if you just want to organize it's 160 contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are allowed. 161 162 - `floppy_files` (array of strings) - A list of files to place onto a floppy 163 disk that is attached when the VM is booted. This is most useful for 164 unattended Windows installs, which look for an `Autounattend.xml` file on 165 removable media. By default, no floppy will be attached. All files listed in 166 this setting get placed into the root directory of the floppy and the floppy 167 is attached as the first floppy device. Currently, no support exists for 168 creating sub-directories on the floppy. Wildcard characters (\*, ?, 169 and \[\]) are allowed. Directory names are also allowed, which will add all 170 the files found in the directory to the floppy. 171 172 - `fusion_app_path` (string) - Path to "VMware Fusion.app". By default this is 173 `/Applications/VMware Fusion.app` but this setting allows you to 174 customize this. 175 176 - `guest_os_type` (string) - The guest OS type being installed. This will be 177 set in the VMware VMX. By default this is `other`. By specifying a more 178 specific OS type, VMware may perform some optimizations or virtual hardware 179 changes to better support the operating system running in the 180 virtual machine. 181 182 - `headless` (boolean) - Packer defaults to building VMware virtual machines 183 by launching a GUI that shows the console of the machine being built. When 184 this value is set to `true`, the machine will start without a console. For 185 VMware machines, Packer will output VNC connection information in case you 186 need to connect to the console to debug the build process. 187 188 - `http_directory` (string) - Path to a directory to serve using an 189 HTTP server. The files in this directory will be available over HTTP that 190 will be requestable from the virtual machine. This is useful for hosting 191 kickstart files and so on. By default this is an empty string, which means 192 no HTTP server will be started. The address and port of the HTTP server will 193 be available as variables in `boot_command`. This is covered in more detail 194 below. 195 196 - `http_port_min` and `http_port_max` (number) - These are the minimum and 197 maximum port to use for the HTTP server started to serve the 198 `http_directory`. Because Packer often runs in parallel, Packer will choose 199 a randomly available port in this range to run the HTTP server. If you want 200 to force the HTTP server to be on one port, make this minimum and maximum 201 port the same. By default the values are `8000` and `9000`, respectively. 202 203 - `iso_target_extension` (string) - The extension of the iso file after 204 download. This defaults to `iso`. 205 206 - `iso_target_path` (string) - The path where the iso should be saved after 207 download. By default will go in the packer cache, with a hash of the 208 original filename as its name. 209 210 - `iso_urls` (array of strings) - Multiple URLs for the ISO to download. 211 Packer will try these in order. If anything goes wrong attempting to 212 download or while downloading a single URL, it will move on to the next. All 213 URLs must point to the same file (same checksum). By default this is empty 214 and `iso_url` is used. Only one of `iso_url` or `iso_urls` can be specified. 215 216 - `network` (string) - This is the network type that the virtual machine will 217 be created with. This can be one of the generic values that map to a device 218 such as `hostonly`, `nat`, or `bridged`. If the network is not one of these 219 values, then it is assumed to be a VMware network device. (VMnet0..x) 220 221 - `network_adapter_type` (string) - This is the ethernet adapter type the the 222 virtual machine will be created with. By default the `e1000` network adapter 223 type will be used by Packer. For more information, please consult the 224 <a href="https://kb.vmware.com/s/article/1001805" target="_blank" 225 rel="nofollow noopener noreferrer"> 226 Choosing a network adapter for your virtual machine</a> for desktop VMware 227 clients. For ESXi, refer to the proper ESXi documentation. 228 229 - `output_directory` (string) - This is the path to the directory where the 230 resulting virtual machine will be created. This may be relative or absolute. 231 If relative, the path is relative to the working directory when `packer` 232 is executed. This directory must not exist or be empty prior to running 233 the builder. By default this is `output-BUILDNAME` where "BUILDNAME" is the 234 name of the build. 235 236 - `parallel` (string) - This specifies a parallel port to add to the VM. It 237 has the format of `Type:option1,option2,...`. Type can be one of the 238 following values: `FILE`, `DEVICE`, `AUTO`, or `NONE`. 239 240 * `FILE:path` - Specifies the path to the local file to be used for the 241 parallel port. 242 * `DEVICE:path` - Specifies the path to the local device to be used for the 243 parallel port. 244 * `AUTO:direction` - Specifies to use auto-detection to determine the 245 parallel port. Direction can be `BI` to specify 246 bidirectional communication or `UNI` to specify 247 unidirectional communication. 248 * `NONE` - Specifies to not use a parallel port. (default) 249 250 - `remote_cache_datastore` (string) - The path to the datastore where 251 supporting files will be stored during the build on the remote machine. By 252 default this is the same as the `remote_datastore` option. This only has an 253 effect if `remote_type` is enabled. 254 255 - `remote_cache_directory` (string) - The path where the ISO and/or floppy 256 files will be stored during the build on the remote machine. The path is 257 relative to the `remote_cache_datastore` on the remote machine. By default 258 this is `packer_cache`. This only has an effect if `remote_type` 259 is enabled. 260 261 - `remote_datastore` (string) - The path to the datastore where the resulting 262 VM will be stored when it is built on the remote machine. By default this 263 is `datastore1`. This only has an effect if `remote_type` is enabled. 264 265 - `remote_host` (string) - The host of the remote machine used for access. 266 This is only required if `remote_type` is enabled. 267 268 - `remote_password` (string) - The SSH password for the user used to access 269 the remote machine. By default this is empty. This only has an effect if 270 `remote_type` is enabled. 271 272 - `remote_private_key_file` (string) - The path to the PEM encoded private key 273 file for the user used to access the remote machine. By default this is empty. 274 This only has an effect if `remote_type` is enabled. 275 276 - `remote_type` (string) - The type of remote machine that will be used to 277 build this VM rather than a local desktop product. The only value accepted 278 for this currently is `esx5`. If this is not set, a desktop product will 279 be used. By default, this is not set. 280 281 - `remote_username` (string) - The username for the SSH user that will access 282 the remote machine. This is required if `remote_type` is enabled. 283 284 - `serial` (string) - This specifies a serial port to add to the VM. 285 It has a format of `Type:option1,option2,...`. The field `Type` can be one 286 of the following values: `FILE`, `DEVICE`, `PIPE`, `AUTO`, or `NONE`. 287 288 * `FILE:path(,yield)` - Specifies the path to the local file to be used as the 289 serial port. 290 * `yield` (bool) - This is an optional boolean that specifies whether 291 the vm should yield the cpu when polling the port. 292 By default, the builder will assume this as `FALSE`. 293 * `DEVICE:path(,yield)` - Specifies the path to the local device to be used 294 as the serial port. If `path` is empty, then 295 default to the first serial port. 296 * `yield` (bool) - This is an optional boolean that specifies whether 297 the vm should yield the cpu when polling the port. 298 By default, the builder will assume this as `FALSE`. 299 * `PIPE:path,endpoint,host(,yield)` - Specifies to use the named-pipe "path" 300 as a serial port. This has a few 301 options that determine how the VM 302 should use the named-pipe. 303 * `endpoint` (string) - Chooses the type of the VM-end, which can be 304 either a `client` or `server`. 305 * `host` (string) - Chooses the type of the host-end, which can be either 306 an `app` (application) or `vm` (another virtual-machine). 307 * `yield` (bool) - This is an optional boolean that specifies whether 308 the vm should yield the cpu when polling the port. 309 By default, the builder will assume this as `FALSE`. 310 311 * `AUTO:(yield)` - Specifies to use auto-detection to determine the serial 312 port to use. This has one option to determine how the VM 313 should support the serial port. 314 * `yield` (bool) - This is an optional boolean that specifies whether 315 the vm should yield the cpu when polling the port. 316 By default, the builder will assume this as `FALSE`. 317 * `NONE` - Specifies to not use a serial port. (default) 318 319 - `shutdown_command` (string) - The command to use to gracefully shut down the 320 machine once all the provisioning is done. By default this is an empty 321 string, which tells Packer to just forcefully shut down the machine. 322 323 - `shutdown_timeout` (string) - The amount of time to wait after executing the 324 `shutdown_command` for the virtual machine to actually shut down. If it 325 doesn't shut down in this time, it is an error. By default, the timeout is 326 `5m` or five minutes. 327 328 - `skip_compaction` (boolean) - VMware-created disks are defragmented and 329 compacted at the end of the build process using `vmware-vdiskmanager`. In 330 certain rare cases, this might actually end up making the resulting disks 331 slightly larger. If you find this to be the case, you can disable compaction 332 using this configuration value. Defaults to `false`. 333 334 - `skip_export` (boolean) - Defaults to `false`. When enabled, Packer will 335 not export the VM. Useful if the build output is not the resultant 336 image, but created inside the VM. 337 Currently, exporting the build VM is only supported when building on 338 ESXi e.g. when `remote_type` is set to `esx5`. See the [Building on a 339 Remote vSphere 340 Hypervisor](/docs/builders/vmware-iso.html#building-on-a-remote-vsphere-hypervisor) 341 section below for more info. 342 343 - `keep_registered` (boolean) - Set this to `true` if you would like to keep 344 the VM registered with the remote ESXi server. This is convenient if you 345 use packer to provision VMs on ESXi and don't want to use ovftool to 346 deploy the resulting artifact (VMX or OVA or whatever you used as `format`). 347 Defaults to `false`. 348 349 - `ovftool_options` (array of strings) - Extra options to pass to ovftool 350 during export. Each item in the array is a new argument. The options 351 `--noSSLVerify`, `--skipManifestCheck`, and `--targetType` are reserved, 352 and should not be passed to this argument. 353 Currently, exporting the build VM (with ovftool) is only supported when 354 building on ESXi e.g. when `remote_type` is set to `esx5`. See the 355 [Building on a Remote vSphere 356 Hypervisor](/docs/builders/vmware-iso.html#building-on-a-remote-vsphere-hypervisor) 357 section below for more info. 358 359 - `sound` (boolean) - Enable VMware's virtual soundcard device for the VM. 360 361 - `tools_upload_flavor` (string) - The flavor of the VMware Tools ISO to 362 upload into the VM. Valid values are `darwin`, `linux`, and `windows`. By 363 default, this is empty, which means VMware tools won't be uploaded. 364 365 - `tools_upload_path` (string) - The path in the VM to upload the 366 VMware tools. This only takes effect if `tools_upload_flavor` is non-empty. 367 This is a [configuration 368 template](/docs/templates/engine.html) that has a single 369 valid variable: `Flavor`, which will be the value of `tools_upload_flavor`. 370 By default the upload path is set to `{{.Flavor}}.iso`. This setting is not 371 used when `remote_type` is `esx5`. 372 373 - `usb` (boolean) - Enable VMware's USB bus for the guest VM. To enable usage 374 of the XHCI bus for USB 3 (5 Gbit/s), one can use the `vmx_data` option to 375 enable it by specifying `true` for the `usb_xhci.present` property. 376 377 - `version` (string) - The [vmx hardware 378 version](http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1003746) 379 for the new virtual machine. Only the default value has been tested, any 380 other value is experimental. Default value is `9`. 381 382 - `vm_name` (string) - This is the name of the VMX file for the new virtual 383 machine, without the file extension. By default this is `packer-BUILDNAME`, 384 where "BUILDNAME" is the name of the build. 385 386 - `vmdk_name` (string) - The filename of the virtual disk that'll be created, 387 without the extension. This defaults to `packer`. 388 389 - `vmx_data` (object of key/value strings) - Arbitrary key/values to enter 390 into the virtual machine VMX file. This is for advanced users who want to 391 set properties such as memory, CPU, etc. 392 393 - `vmx_data_post` (object of key/value strings) - Identical to `vmx_data`, 394 except that it is run after the virtual machine is shutdown, and before the 395 virtual machine is exported. 396 397 - `vmx_remove_ethernet_interfaces` (boolean) - Remove all ethernet interfaces 398 from the VMX file after building. This is for advanced users who understand 399 the ramifications, but is useful for building Vagrant boxes since Vagrant 400 will create ethernet interfaces when provisioning a box. Defaults to 401 `false`. 402 403 - `vmx_template_path` (string) - Path to a [configuration 404 template](/docs/templates/engine.html) that defines the 405 contents of the virtual machine VMX file for VMware. This is for **advanced 406 users only** as this can render the virtual machine non-functional. See 407 below for more information. For basic VMX modifications, try 408 `vmx_data` first. 409 410 - `vnc_bind_address` (string / IP address) - The IP address that should be 411 binded to for VNC. By default packer will use `127.0.0.1` for this. If you 412 wish to bind to all interfaces use `0.0.0.0`. 413 414 - `vnc_disable_password` (boolean) - Don't auto-generate a VNC password that 415 is used to secure the VNC communication with the VM. This must be set to 416 `true` if building on ESXi 6.5 and 6.7 with VNC enabled. Defaults to 417 `false`. 418 419 - `vnc_port_min` and `vnc_port_max` (number) - The minimum and maximum port 420 to use for VNC access to the virtual machine. The builder uses VNC to type 421 the initial `boot_command`. Because Packer generally runs in parallel, 422 Packer uses a randomly chosen port in this range that appears available. By 423 default this is `5900` to `6000`. The minimum and maximum ports are 424 inclusive. 425 426 ## Boot Command 427 428 The `boot_command` configuration is very important: it specifies the keys to 429 type when the virtual machine is first booted in order to start the OS 430 installer. This command is typed after `boot_wait`, which gives the virtual 431 machine some time to actually load the ISO. 432 433 As documented above, the `boot_command` is an array of strings. The strings are 434 all typed in sequence. It is an array only to improve readability within the 435 template. 436 437 The boot command is "typed" character for character over a VNC connection to the 438 machine, simulating a human actually typing the keyboard. 439 440 -> Keystrokes are typed as separate key up/down events over VNC with a 441 default 100ms delay. The delay alleviates issues with latency and CPU 442 contention. For local builds you can tune this delay by specifying 443 e.g. `PACKER_KEY_INTERVAL=10ms` to speed through the boot command. 444 445 <%= partial "partials/builders/boot-command" %> 446 447 -> **Note**: for the `HTTPIP` to be resolved correctly, your VM's network 448 configuration has to include a `hostonly` or `nat` type network interface. 449 If you are using this feature, it is recommended to leave the default network 450 configuration while you are building the VM, and use the `vmx_data_post` hook 451 to modify the network configuration after the VM is done building. 452 453 Example boot command. This is actually a working boot command used to start an 454 Ubuntu 12.04 installer: 455 456 ``` text 457 [ 458 "<esc><esc><enter><wait>", 459 "/install/vmlinuz noapic ", 460 "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", 461 "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", 462 "hostname={{ .Name }} ", 463 "fb=false debconf/frontend=noninteractive ", 464 "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", 465 "keyboard-configuration/variant=USA console-setup/ask_detect=false ", 466 "initrd=/install/initrd.gz -- <enter>" 467 ] 468 ``` 469 470 For more examples of various boot commands, see the sample projects from our 471 [community templates page](/community-tools.html#templates). 472 473 ## VMX Template 474 475 The heart of a VMware machine is the "vmx" file. This contains all the virtual 476 hardware metadata necessary for the VM to function. Packer by default uses a 477 [safe, flexible VMX 478 file](https://github.com/hashicorp/packer/blob/20541a7eda085aa5cf35bfed5069592ca49d106e/builder/vmware/step_create_vmx.go#L84). 479 But for advanced users, this template can be customized. This allows Packer to 480 build virtual machines of effectively any guest operating system type. 481 482 ~> **This is an advanced feature.** Modifying the VMX template can easily 483 cause your virtual machine to not boot properly. Please only modify the template 484 if you know what you're doing. 485 486 Within the template, a handful of variables are available so that your template 487 can continue working with the rest of the Packer machinery. Using these 488 variables isn't required, however. 489 490 - `Name` - The name of the virtual machine. 491 - `GuestOS` - The VMware-valid guest OS type. 492 - `DiskName` - The filename (without the suffix) of the main virtual disk. 493 - `ISOPath` - The path to the ISO to use for the OS installation. 494 - `Version` - The Hardware version VMWare will execute this vm under. Also 495 known as the `virtualhw.version`. 496 497 ## Building on a Remote vSphere Hypervisor 498 499 In addition to using the desktop products of VMware locally to build virtual 500 machines, Packer can use a remote VMware Hypervisor to build the virtual 501 machine. 502 503 -> **Note:** Packer supports ESXi 5.1 and above. 504 505 Before using a remote vSphere Hypervisor, you need to enable GuestIPHack by 506 running the following command: 507 508 ``` text 509 esxcli system settings advanced set -o /Net/GuestIPHack -i 1 510 ``` 511 512 When using a remote VMware Hypervisor, the builder still downloads the ISO and 513 various files locally, and uploads these to the remote machine. Packer currently 514 uses SSH to communicate to the ESXi machine rather than the vSphere API. At some 515 point, the vSphere API may be used. 516 517 Packer also requires VNC to issue boot commands during a build, which may be 518 disabled on some remote VMware Hypervisors. Please consult the appropriate 519 documentation on how to update VMware Hypervisor's firewall to allow these 520 connections. VNC can be disabled by not setting a `boot_command` and setting 521 `disable_vnc` to `true`. 522 523 To use a remote VMware vSphere Hypervisor to build your virtual machine, fill in 524 the required `remote_*` configurations: 525 526 - `remote_type` - This must be set to "esx5". 527 528 - `remote_host` - The host of the remote machine. 529 530 Additionally, there are some optional configurations that you'll likely have to 531 modify as well: 532 533 - `remote_port` - The SSH port of the remote machine 534 535 - `remote_datastore` - The path to the datastore where the VM will be stored 536 on the ESXi machine. 537 538 - `remote_cache_datastore` - The path to the datastore where supporting files 539 will be stored during the build on the remote machine. 540 541 - `remote_cache_directory` - The path where the ISO and/or floppy files will 542 be stored during the build on the remote machine. The path is relative to 543 the `remote_cache_datastore` on the remote machine. 544 545 - `remote_username` - The SSH username used to access the remote machine. 546 547 - `remote_password` - The SSH password for access to the remote machine. 548 549 - `remote_private_key_file` - The SSH key for access to the remote machine. 550 551 - `format` (string) - Either "ovf", "ova" or "vmx", this specifies the output 552 format of the exported virtual machine. This defaults to "ovf". 553 Before using this option, you need to install `ovftool`. This option 554 currently only works when option remote_type is set to "esx5". 555 Since ovftool is only capable of password based authentication 556 `remote_password` must be set when exporting the VM. 557 558 - `vnc_disable_password` - This must be set to "true" when using VNC with 559 ESXi 6.5 or 6.7. 560 561 ### VNC port discovery 562 563 Packer needs to decide on a port to use for VNC when building remotely. To find 564 an open port, we try to connect to ports in the range of `vnc_port_min` to 565 `vnc_port_max`. If we notice something is listening on a port in the range, we 566 try to connect to the next one, and so on until we find a port that has nothing 567 listening on it. If you have many clients building on the ESXi host, there 568 might be competition for the VNC ports. You can adjust how long packer waits 569 for a connection timeout by setting `PACKER_ESXI_VNC_PROBE_TIMEOUT`. This 570 defaults to 15 seconds. Set this shorter if vnc connections are refused, and 571 set it longer if Packer can't find an open port. This is intended as an 572 advanced configuration option. Please make sure your firewall settings are 573 correct before adjusting. 574 575 ### Using a Floppy for Linux kickstart file or preseed 576 577 Depending on your network configuration, it may be difficult to use packer's 578 built-in HTTP server with ESXi. Instead, you can provide a kickstart or preseed 579 file by attaching a floppy disk. An example below, based on RHEL: 580 581 ``` json 582 { 583 "builders": [ 584 { 585 "type":"vmware-iso", 586 "floppy_files": [ 587 "folder/ks.cfg" 588 ], 589 "boot_command": "<tab> text ks=floppy <enter><wait>" 590 } 591 ] 592 } 593 ``` 594 595 It's also worth noting that `ks=floppy` has been deprecated. Later versions of 596 the Anaconda installer (used in RHEL/CentOS 7 and Fedora) may require 597 a different syntax to source a kickstart file from a mounted floppy image. 598 599 ``` json 600 { 601 "builders": [ 602 { 603 "type":"vmware-iso", 604 "floppy_files": [ 605 "folder/ks.cfg" 606 ], 607 "boot_command": "<tab> inst.text inst.ks=hd:fd0:/ks.cfg <enter><wait>" 608 } 609 ] 610 } 611 ```