|
|
|
|
@ -76,12 +76,10 @@ builder.
|
|
|
|
|
### Required:
|
|
|
|
|
|
|
|
|
|
<%= partial "partials/common/ISOConfig-required" %>
|
|
|
|
|
<%= partial "partials/common/CommonConfig" %>
|
|
|
|
|
|
|
|
|
|
### Optional:
|
|
|
|
|
|
|
|
|
|
<%= partial "partials/common/ISOConfig-not-required" %>
|
|
|
|
|
<%= partial "partials/common/CommonConfig-not-required" %>
|
|
|
|
|
|
|
|
|
|
### Required for virtual machine import:
|
|
|
|
|
|
|
|
|
|
@ -101,199 +99,8 @@ builder.
|
|
|
|
|
|
|
|
|
|
### Optional:
|
|
|
|
|
|
|
|
|
|
- `boot_command` (array of strings) - This is an array of commands to type
|
|
|
|
|
when the virtual machine is first booted. The goal of these commands
|
|
|
|
|
should be to type just enough to initialize the operating system
|
|
|
|
|
installer. Special keys can be typed as well, and are covered in the
|
|
|
|
|
section below on the boot command. If this is not specified, it is assumed
|
|
|
|
|
the installer will start itself.
|
|
|
|
|
|
|
|
|
|
- `boot_wait` (string) - The time to wait after booting the initial virtual
|
|
|
|
|
machine before typing the `boot_command`. The value specified should be
|
|
|
|
|
a duration. For example, setting a duration of "1m30s" would cause
|
|
|
|
|
Packer to wait for 1 minute 30 seconds before typing the boot command.
|
|
|
|
|
The default duration is "10s" (10 seconds).
|
|
|
|
|
|
|
|
|
|
- `clone_all_snapshots` (boolean) - If set to `true` all snapshots
|
|
|
|
|
present in the source machine will be copied when the machine is
|
|
|
|
|
cloned. The final result of the build will be an exported virtual
|
|
|
|
|
machine that contains all the snapshots of the parent.
|
|
|
|
|
|
|
|
|
|
If `clone_from_vmcx_path` is set, this setting has no effect and any
|
|
|
|
|
snapshots associated with the source VM will also be present in the
|
|
|
|
|
resultant VM.
|
|
|
|
|
|
|
|
|
|
If `clone_from_snapshot_name` is configured, this setting has no
|
|
|
|
|
effect and the resultant machine will not contain any snapshots.
|
|
|
|
|
|
|
|
|
|
- `clone_from_snapshot_name` (string) - The name of a snapshot in the
|
|
|
|
|
source machine to use as a starting point for the clone. If the value
|
|
|
|
|
given is an empty string, the last snapshot present in the source will
|
|
|
|
|
be chosen as the starting point for the new VM.
|
|
|
|
|
|
|
|
|
|
This setting only has an effect if using `clone_from_vm_name` and is
|
|
|
|
|
ignored otherwise.
|
|
|
|
|
|
|
|
|
|
- `copy_in_compare` (boolean) - When cloning a vm to build from, we run a powershell
|
|
|
|
|
Compare-VM command, which, depending on your version of Windows, may need
|
|
|
|
|
the "Copy" flag to be set to true or false. Defaults to "false". Command:
|
|
|
|
|
|
|
|
|
|
`$compatibilityReport = Hyper-V\Compare-VM -Path $VirtualMachinePath -VirtualMachinePath $importPath -SmartPagingFilePath $importPath -SnapshotFilePath $importPath -VhdDestinationPath $VirtualHarddisksPath -GenerateNewId -Copy:$copy`
|
|
|
|
|
|
|
|
|
|
Where $copy is replaced with either true or false depending on the value of
|
|
|
|
|
"copy_in_compare".
|
|
|
|
|
|
|
|
|
|
- `configuration_version` (string) - This allows you to set the vm version when
|
|
|
|
|
calling New-VM to generate the vm.
|
|
|
|
|
|
|
|
|
|
- `cpus` (number) - The number of CPUs the virtual machine should use. If
|
|
|
|
|
this isn't specified, the default is 1 CPU.
|
|
|
|
|
|
|
|
|
|
- `enable_dynamic_memory` (boolean) - If `true` enable dynamic memory for
|
|
|
|
|
the virtual machine. This defaults to `false`.
|
|
|
|
|
|
|
|
|
|
- `enable_mac_spoofing` (boolean) - If `true` enable MAC address spoofing
|
|
|
|
|
for the virtual machine. This defaults to `false`.
|
|
|
|
|
|
|
|
|
|
- `enable_secure_boot` (boolean) - If `true` enable secure boot for the
|
|
|
|
|
virtual machine. This defaults to `false`. See `secure_boot_template`
|
|
|
|
|
below for additional settings.
|
|
|
|
|
|
|
|
|
|
- `enable_virtualization_extensions` (boolean) - If `true` enable
|
|
|
|
|
virtualization extensions for the virtual machine. This defaults to
|
|
|
|
|
`false`. For nested virtualization you need to enable MAC spoofing,
|
|
|
|
|
disable dynamic memory and have at least 4GB of RAM assigned to the
|
|
|
|
|
virtual machine.
|
|
|
|
|
|
|
|
|
|
- `floppy_dirs` (array of strings) - A list of directories to place onto
|
|
|
|
|
the floppy disk recursively. This is similar to the `floppy_files` option
|
|
|
|
|
except that the directory structure is preserved. This is useful for when
|
|
|
|
|
your floppy disk includes drivers or if you just want to organize it's
|
|
|
|
|
contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are
|
|
|
|
|
allowed. The maximum summary size of all files in the listed directories
|
|
|
|
|
are the same as in `floppy_files`.
|
|
|
|
|
|
|
|
|
|
- `floppy_files` (array of strings) - A list of files to place onto a floppy
|
|
|
|
|
disk that is attached when the VM is booted. This is most useful for
|
|
|
|
|
unattended Windows installs, which look for an `Autounattend.xml` file on
|
|
|
|
|
removable media. By default, no floppy will be attached. All files listed
|
|
|
|
|
in this setting get placed into the root directory of the floppy and the
|
|
|
|
|
floppy is attached as the first floppy device. Currently, no support
|
|
|
|
|
exists for creating sub-directories on the floppy. Wildcard characters
|
|
|
|
|
(`*`, `?`, and `[]`) are allowed. Directory names are also allowed, which
|
|
|
|
|
will add all the files found in the directory to the floppy.
|
|
|
|
|
|
|
|
|
|
- `floppy_label` (string) - The label to use for the floppy disk that
|
|
|
|
|
is attached when the VM is booted. This is most useful for cloud-init,
|
|
|
|
|
Kickstart or other early initialization tools, which can benefit from labelled floppy disks.
|
|
|
|
|
By default, the floppy label will be 'packer'.
|
|
|
|
|
|
|
|
|
|
- `guest_additions_mode` (string) - If set to `attach` then attach and
|
|
|
|
|
mount the ISO image specified in `guest_additions_path`. If set to
|
|
|
|
|
`none` then guest additions are not attached and mounted; This is the
|
|
|
|
|
default.
|
|
|
|
|
|
|
|
|
|
- `guest_additions_path` (string) - The path to the ISO image for guest
|
|
|
|
|
additions.
|
|
|
|
|
|
|
|
|
|
- `headless` (boolean) - Packer defaults to building Hyper-V virtual
|
|
|
|
|
machines by launching a GUI that shows the console of the machine being
|
|
|
|
|
built. When this value is set to true, the machine will start without a
|
|
|
|
|
console.
|
|
|
|
|
|
|
|
|
|
- `http_directory` (string) - Path to a directory to serve using Packers
|
|
|
|
|
inbuilt HTTP server. The files in this directory will be available
|
|
|
|
|
over HTTP to the virtual machine. This is useful for hosting kickstart
|
|
|
|
|
files and so on. By default this value is unset and the HTTP server is
|
|
|
|
|
not started. The address and port of the HTTP server will be available
|
|
|
|
|
as variables in `boot_command`. This is covered in more detail below.
|
|
|
|
|
|
|
|
|
|
- `http_port_min` and `http_port_max` (number) - These are the minimum and
|
|
|
|
|
maximum port to use for the HTTP server started to serve the
|
|
|
|
|
`http_directory`. Since Packer often runs in parallel, a randomly
|
|
|
|
|
available port in this range will be repeatedly chosen until an
|
|
|
|
|
available port is found. To force the HTTP server to use a specific
|
|
|
|
|
port, set an identical value for `http_port_min` and `http_port_max`.
|
|
|
|
|
By default the values are 8000 and 9000, respectively.
|
|
|
|
|
|
|
|
|
|
- `keep_registered` (bool) - If "true", Packer will not delete the VM from
|
|
|
|
|
The Hyper-V manager.
|
|
|
|
|
|
|
|
|
|
- `mac_address` (string) - This allows a specific MAC address to be used on
|
|
|
|
|
the default virtual network card. The MAC address must be a string with
|
|
|
|
|
no delimiters, for example "0000deadbeef".
|
|
|
|
|
|
|
|
|
|
- `output_directory` (string) - This setting specifies the directory that
|
|
|
|
|
artifacts from the build, such as the virtual machine files and disks,
|
|
|
|
|
will be output to. The path to the directory may be relative or
|
|
|
|
|
absolute. If relative, the path is relative to the working directory
|
|
|
|
|
`packer` is executed from. This directory must not exist or, if
|
|
|
|
|
created, must be empty prior to running the builder. By default this is
|
|
|
|
|
"output-BUILDNAME" where "BUILDNAME" is the name of the build.
|
|
|
|
|
|
|
|
|
|
- `memory` (number) - The amount, in megabytes, of RAM to assign to the
|
|
|
|
|
VM. By default, this is 1 GB.
|
|
|
|
|
|
|
|
|
|
- `secondary_iso_images` (array of strings) - A list of ISO paths to
|
|
|
|
|
attach to a VM when it is booted. This is most useful for unattended
|
|
|
|
|
Windows installs, which look for an `Autounattend.xml` file on removable
|
|
|
|
|
media. By default, no secondary ISO will be attached.
|
|
|
|
|
|
|
|
|
|
- `secure_boot_template` (string) - The secure boot template to be
|
|
|
|
|
configured. Valid values are "MicrosoftWindows" (Windows) or
|
|
|
|
|
"MicrosoftUEFICertificateAuthority" (Linux). This only takes effect if
|
|
|
|
|
`enable_secure_boot` is set to "true". This defaults to "MicrosoftWindows".
|
|
|
|
|
|
|
|
|
|
- `shutdown_command` (string) - The command to use to gracefully shut down
|
|
|
|
|
the machine once all provisioning is complete. By default this is an
|
|
|
|
|
empty string, which tells Packer to just forcefully shut down the
|
|
|
|
|
machine. This setting can be safely omitted if for example, a shutdown
|
|
|
|
|
command to gracefully halt the machine is configured inside a
|
|
|
|
|
provisioning script. If one or more scripts require a reboot it is
|
|
|
|
|
suggested to leave this blank (since reboots may fail) and instead
|
|
|
|
|
specify the final shutdown command in your last script.
|
|
|
|
|
|
|
|
|
|
- `shutdown_timeout` (string) - The amount of time to wait after executing
|
|
|
|
|
the `shutdown_command` for the virtual machine to actually shut down.
|
|
|
|
|
If the machine doesn't shut down in this time it is considered an
|
|
|
|
|
error. By default, the time out is "5m" (five minutes).
|
|
|
|
|
|
|
|
|
|
- `skip_compaction` (boolean) - If `true` skip compacting the hard disk for
|
|
|
|
|
the virtual machine when exporting. This defaults to `false`.
|
|
|
|
|
|
|
|
|
|
- `skip_export` (boolean) - If `true` Packer will skip the export of the VM.
|
|
|
|
|
If you are interested only in the VHD/VHDX files, you can enable this
|
|
|
|
|
option. The resulting VHD/VHDX file will be output to
|
|
|
|
|
`<output_directory>/Virtual Hard Disks`. By default this option is `false`
|
|
|
|
|
and Packer will export the VM to `output_directory`.
|
|
|
|
|
|
|
|
|
|
- `switch_name` (string) - The name of the switch to connect the virtual
|
|
|
|
|
machine to. By default, leaving this value unset will cause Packer to
|
|
|
|
|
try and determine the switch to use by looking for an external switch
|
|
|
|
|
that is up and running.
|
|
|
|
|
|
|
|
|
|
- `switch_vlan_id` (string) - This is the VLAN of the virtual switch's
|
|
|
|
|
network card. By default none is set. If none is set then a VLAN is not
|
|
|
|
|
set on the switch's network card. If this value is set it should match
|
|
|
|
|
the VLAN specified in by `vlan_id`.
|
|
|
|
|
|
|
|
|
|
- `temp_path` (string) - The location under which Packer will create a
|
|
|
|
|
directory to house all the VM files and folders during the build.
|
|
|
|
|
By default `%TEMP%` is used which, for most systems, will evaluate to
|
|
|
|
|
`%USERPROFILE%/AppData/Local/Temp`.
|
|
|
|
|
|
|
|
|
|
The build directory housed under `temp_path` will have a name similar
|
|
|
|
|
to `packerhv1234567`. The seven digit number at the end of the name is
|
|
|
|
|
automatically generated by Packer to ensure the directory name is
|
|
|
|
|
unique.
|
|
|
|
|
|
|
|
|
|
- `vlan_id` (string) - This is the VLAN of the virtual machine's network
|
|
|
|
|
card for the new virtual machine. By default none is set. If none is set
|
|
|
|
|
then VLANs are not set on the virtual machine's network card.
|
|
|
|
|
|
|
|
|
|
- `vm_name` (string) - This is the name of the new virtual machine,
|
|
|
|
|
without the file extension. By default this is "packer-BUILDNAME",
|
|
|
|
|
where "BUILDNAME" is the name of the build.
|
|
|
|
|
<%= partial "partials/builder/hyperv/vmcx/Config-not-required" %>
|
|
|
|
|
<%= partial "partials/builder/hyperv/common/CommonConfig-not-required" %>
|
|
|
|
|
|
|
|
|
|
## Boot Command
|
|
|
|
|
|
|
|
|
|
|