Hyper-V VMCX: Minor word changes and fixes

This commit is contained in:
DanHam 2018-06-14 18:32:33 +01:00
parent 866ee26771
commit 644f509f1d
No known key found for this signature in database
GPG Key ID: 58E79AEDD6AA987E
1 changed files with 201 additions and 185 deletions

View File

@ -5,7 +5,7 @@ description: |-
The Hyper-V Packer builder is able to clone an existing Hyper-V virtual machine and export them. The Hyper-V Packer builder is able to clone an existing Hyper-V virtual machine and export them.
layout: "docs" layout: "docs"
sidebar_current: 'docs-builders-hyperv-vmcx' sidebar_current: 'docs-builders-hyperv-vmcx'
page_title: "Hyper-V Builder (from an vmcx)" page_title: "Hyper-V Builder (from a vmcx)"
--- ---
# Hyper-V Builder (from a vmcx) # Hyper-V Builder (from a vmcx)
@ -17,8 +17,8 @@ existing
[Hyper-V](https://www.microsoft.com/en-us/server-cloud/solutions/virtualization.aspx) [Hyper-V](https://www.microsoft.com/en-us/server-cloud/solutions/virtualization.aspx)
virtual machines. virtual machines.
The builder imports a virtual machine or clones an existing virtual machine Typically, the builder imports or clones an existing virtual machine,
boots it, and provisioning software within the OS, then shutting it down. The boots it, provisions software within the OS, and then shuts it down. The
result of the Hyper-V builder is a directory containing all the files result of the Hyper-V builder is a directory containing all the files
necessary to run the virtual machine portably. necessary to run the virtual machine portably.
@ -30,7 +30,7 @@ to self-install. Still, the example serves to show the basic configuration:
Import from folder: Import from folder:
```json ``` json
{ {
"type": "hyperv-vmcx", "type": "hyperv-vmcx",
"clone_from_vmxc_path": "c:\\virtual machines\\ubuntu-12.04.5-server-amd64", "clone_from_vmxc_path": "c:\\virtual machines\\ubuntu-12.04.5-server-amd64",
@ -42,7 +42,7 @@ Import from folder:
Clone from existing virtual machine: Clone from existing virtual machine:
```json ``` json
{ {
"clone_from_vm_name": "ubuntu-12.04.5-server-amd64", "clone_from_vm_name": "ubuntu-12.04.5-server-amd64",
"shutdown_command": "echo 'packer' | sudo -S shutdown -P now", "shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
@ -52,13 +52,16 @@ Clone from existing virtual machine:
} }
``` ```
It is important to add a `shutdown_command`. By default Packer halts the By default Packer will perform a hard power off of a virtual machine.
virtual machine and the file system may not be sync'd. Thus, changes made in a However, when a machine is powered off this way, it is possible that
provisioner might not be saved. changes made to the VMs file system may not be fully synced, possibly
leading to corruption of files or lost changes. As such, it is important to
add a `shutdown_command`. This tells Packer how to safely shutdown and
power off the VM.
## Configuration Reference ## Configuration Reference
There are many configuration options available for the Hyper-V builder. They There are many configuration options available for the Hyper-V builder. They
are organized below into two categories: required and optional. Within each are organized below into two categories: required and optional. Within each
category, the available options are alphabetized and described. category, the available options are alphabetized and described.
@ -81,43 +84,47 @@ builder.
- `boot_command` (array of strings) - This is an array of commands to type - `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 when the virtual machine is first booted. The goal of these commands
should be to type just enough to initialize the operating system should be to type just enough to initialize the operating system
installer. Special keys can be typed as well, and are covered in the 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 section below on the boot command. If this is not specified, it is assumed
the installer will start itself. the installer will start itself.
- `boot_wait` (string) - The time to wait after booting the initial virtual - `boot_wait` (string) - The time to wait after booting the initial virtual
machine before typing the `boot_command`. The value of this should be machine before typing the `boot_command`. The value specified should be
a duration. Examples are "5s" and "1m30s" which will cause Packer to wait a duration. For example, setting a duration of "1m30s" would cause
five seconds and one minute 30 seconds, respectively. If this isn't Packer to wait for 1 minute 30 seconds before typing the boot command.
specified, the default is 10 seconds. The default duration is "10s" (10 seconds).
- `clone_all_snapshots` (boolean) - Should all snapshots be cloned when the - `clone_all_snapshots` (boolean) - If set to `true` all snapshots will be
machine is cloned. cloned when the machine is cloned.
- `clone_from_snapshot_name` (string) - The name of the snapshot - `clone_from_snapshot_name` (string) - The name of the snapshot to clone
- `cpu` (number) - The number of cpus the virtual machine should use. If from.
this isn't specified, the default is 1 cpu.
- `enable_dynamic_memory` (boolean) - If true enable dynamic memory for - `cpu` (number) - The number of CPUs the virtual machine should use. If
virtual machine. This defaults to false. this isn't specified, the default is 1 CPU.
- `enable_mac_spoofing` (boolean) - If true enable mac spoofing for virtual - `enable_dynamic_memory` (boolean) - If `true` enable dynamic memory for
machine. This defaults to false. the virtual machine. This defaults to `false`.
- `enable_secure_boot` (boolean) - If true enable secure boot for virtual - `enable_mac_spoofing` (boolean) - If `true` enable MAC address spoofing
machine. This defaults to false. for the virtual machine. This defaults to `false`.
- `enable_virtualization_extensions` (boolean) - If true enable - `enable_secure_boot` (boolean) - If `true` enable secure boot for the
virtualization extensions for virtual machine. This defaults to false. For virtual machine. This defaults to `false`. See `secure_boot_template`
nested virtualization you need to enable mac spoofing, disable dynamic below for additional settings.
memory and have at least 4GB of RAM for virtual machine.
- `floppy_dirs` (array of strings) - A list of directories to place onto the - `enable_virtualization_extensions` (boolean) - If `true` enable
floppy disk recursively. This is similar to the `floppy_files` option 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 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 your floppy disk includes drivers or if you just want to organize it's
contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are contents as a hierarchy. Wildcard characters (\*, ?, and \[\]) are
allowed. The maximum summary size of all files in the listed directories allowed. The maximum summary size of all files in the listed directories
are the same as in `floppy_files`. are the same as in `floppy_files`.
- `floppy_files` (array of strings) - A list of files to place onto a floppy - `floppy_files` (array of strings) - A list of files to place onto a floppy
@ -126,15 +133,16 @@ builder.
removable media. By default, no floppy will be attached. All files listed 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 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 floppy is attached as the first floppy device. Currently, no support
exists for creating sub-directories on the floppy. Wildcard characters (*, exists for creating sub-directories on the floppy. Wildcard characters
?, and []) are allowed. Directory names are also allowed, which will add (`*`, `?`, and `[]`) are allowed. Directory names are also allowed, which
all the files found in the directory to the floppy. will add all the files found in the directory to the floppy.
- `guest_additions_mode` (string) - How should guest additions be installed. - `guest_additions_mode` (string) - If set to `attach` then attach and
If value `attach` then attach iso image with by specified by mount the ISO image specified in `guest_additions_path`. If set to
`guest_additions_path`. Otherwise guest additions is not installed. `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 - `guest_additions_path` (string) - The path to the ISO image for guest
additions. additions.
- `headless` (boolean) - Packer defaults to building Hyper-V virtual - `headless` (boolean) - Packer defaults to building Hyper-V virtual
@ -142,39 +150,41 @@ builder.
built. When this value is set to true, the machine will start without a built. When this value is set to true, the machine will start without a
console. console.
- `http_directory` (string) - Path to a directory to serve using an HTTP - `http_directory` (string) - Path to a directory to serve using Packers
server. The files in this directory will be available over HTTP that will inbuilt HTTP server. The files in this directory will be available
be requestable from the virtual machine. This is useful for hosting over HTTP to the virtual machine. This is useful for hosting kickstart
kickstart files and so on. By default this is "", which means no HTTP files and so on. By default this value is unset and the HTTP server is
server will be started. The address and port of the HTTP server will be not started. The address and port of the HTTP server will be available
available as variables in `boot_command`. This is covered in more detail as variables in `boot_command`. This is covered in more detail below.
below.
- `http_port_min` and `http_port_max` (number) - These are the minimum and - `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 maximum port to use for the HTTP server started to serve the
`http_directory`. Because Packer often runs in parallel, Packer will `http_directory`. Since Packer often runs in parallel, a randomly
choose a randomly available port in this range to run the HTTP server. If available port in this range will be repeatedly chosen until an
you want to force the HTTP server to be on one port, make this minimum and available port is found. To force the HTTP server to use a specific
maximum port the same. By default the values are 8000 and 9000, port, set an identical value for `http_port_min` and `http_port_max`.
respectively. By default the values are 8000 and 9000, respectively.
- `iso_checksum_type` (string) - The type of the checksum specified in - `iso_checksum_type` (string) - The algorithm to be used when computing
`iso_checksum`. Valid values are "none", "md5", "sha1", "sha256", or the checksum of the file specified in `iso_checksum`. Currently, valid
"sha512" currently. While "none" will skip checksumming, this is not values are "none", "md5", "sha1", "sha256", or "sha512". Since the
recommended since ISO files are generally large and corruption does happen validity of ISO and virtual disk files are typically crucial to a
from time to time. successful build, Packer performs a check of any supplied media by
default. While setting "none" will cause Packer to skip this check,
corruption of large files such as ISOs and virtual hard drives can
occur from time to time. As such, skipping this check is not
recommended.
- `iso_checksum` (string) - The checksum for the OS ISO file. Because ISO - `iso_checksum` (string) - The checksum for the ISO file or virtual
files are so large, this is required and Packer will verify it prior to hard drive file. The algorithm to use when computing the checksum is
booting a virtual machine with the ISO attached. The type of the checksum specified with `iso_checksum_type`.
is specified with `iso_checksum_type`, documented below.
- `iso_target_extension` (string) - The extension of the iso file after - `iso_target_extension` (string) - The extension of the ISO file after
download. This defaults to "iso". download. This defaults to "iso".
- `iso_target_path` (string) - The path where the iso should be saved after - `iso_target_path` (string) - The path where the ISO should be saved after
download. By default will go in the packer cache, with a hash of the download. By default the ISO will be saved in the Packer cache
original filename as its name. directory with a hash of the original filename as its name.
- `iso_url` (string) - A URL to the ISO or VHD containing the installation - `iso_url` (string) - A URL to the ISO or VHD containing the installation
image. This URL can be either an HTTP URL or a file URL (or path to a image. This URL can be either an HTTP URL or a file URL (or path to a
@ -189,7 +199,7 @@ builder.
`iso_urls` can be specified. `iso_urls` can be specified.
- `mac_address` (string) - This allows a specific MAC address to be used on - `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 the default virtual network card. The MAC address must be a string with
no delimiters, for example "0000deadbeef". no delimiters, for example "0000deadbeef".
- `output_directory` (string) - This is the path to the directory where the - `output_directory` (string) - This is the path to the directory where the
@ -199,58 +209,59 @@ builder.
running the builder. By default this is "output-BUILDNAME" where running the builder. By default this is "output-BUILDNAME" where
"BUILDNAME" is the name of the build. "BUILDNAME" is the name of the build.
- `ram_size` (number) - The size, in megabytes, of the ram to create for the - `ram_size` (number) - The amount, in megabytes, of RAM to assign to the
VM. By default, this is 1 GB. VM. By default, this is 1 GB.
- `secondary_iso_images` (array of strings) - A list of iso paths to - `secondary_iso_images` (array of strings) - A list of ISO paths to
attached to a VM when it is booted. This is most useful for unattended 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 Windows installs, which look for an `Autounattend.xml` file on removable
media. By default, no secondary iso will be attached. media. By default, no secondary ISO will be attached.
- `secure_boot_template` (string) - The secure boot template to be - `secure_boot_template` (string) - The secure boot template to be
configured. Valid values are "MicrosoftWindows" (Windows) or configured. Valid values are "MicrosoftWindows" (Windows) or
"MicrosoftUEFICertificateAuthority" (Linux). This only takes effect if "MicrosoftUEFICertificateAuthority" (Linux). This only takes effect if
enable_secure_boot is set to "true". This defaults to "MicrosoftWindows". `enable_secure_boot` is set to "true". This defaults to "MicrosoftWindows".
- `shutdown_command` (string) - The command to use to gracefully shut down - `shutdown_command` (string) - The command to use to gracefully shut down
the machine once all the provisioning is done. By default this is an empty the machine once all provisioning is complete. By default this is an
string, which tells Packer to just forcefully shut down the machine unless empty string, which tells Packer to just forcefully shut down the
a shutdown command takes place inside script so this may safely be machine. This setting can be safely omitted if for example, a shutdown
omitted. If one or more scripts require a reboot it is suggested to leave command to gracefully halt the machine is configured inside a
this blank since reboots may fail and specify the final shutdown command provisioning script. If one or more scripts require a reboot it is
in your last script. 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 - `shutdown_timeout` (string) - The amount of time to wait after executing
the `shutdown_command` for the virtual machine to actually shut down. If the `shutdown_command` for the virtual machine to actually shut down.
it doesn't shut down in this time, it is an error. By default, the timeout If the machine doesn't shut down in this time it is considered an
is "5m", or five minutes. error. By default, the time out is "5m" (five minutes).
- `skip_compaction` (boolean) - If true skip compacting the hard disk for - `skip_compaction` (boolean) - If `true` skip compacting the hard disk for
virtual machine when exporting. This defaults to false. the virtual machine when exporting. This defaults to `false`.
- `skip_export` (boolean) - If `true` Packer will skip the export of the - `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 VM. If you are interested only in the VHD/VHDX files, you can enable
this option. This will create inline disks which improves the build this option. This will create inline disks which improves the build
performance. There will not be any copying of source VHDs to the temp performance. There will not be any copying of source VHDs to the temp
directory. This defaults to false. directory. This defaults to `false`.
- `switch_name` (string) - The name of the switch to connect the virtual - `switch_name` (string) - The name of the switch to connect the virtual
machine to. Be defaulting this to an empty string, Packer will try to machine to. By default, leaving this value unset will cause Packer to
determine the switch to use by looking for external switch that is up and try and determine the switch to use by looking for an external switch
running. that is up and running.
- `switch_vlan_id` (string) - This is the vlan of the virtual switch's - `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 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 set on the switch's network card. If this value is set it should match
vlan specified in by `vlan_id`. the VLAN specified in by `vlan_id`.
- `vlan_id` (string) - This is the vlan of the virtual machine's network - `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 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. then VLANs are not set on the virtual machine's network card.
- `vm_name` (string) - This is the name of the virtual machine for the new - `vm_name` (string) - This is the name of the new virtual machine,
virtual machine, without the file extension. By default this is without the file extension. By default this is "packer-BUILDNAME",
"packer-BUILDNAME", where "BUILDNAME" is the name of the build. where "BUILDNAME" is the name of the build.
## Boot Command ## Boot Command
@ -268,10 +279,10 @@ to the machine, simulating a human actually typing the keyboard.
<%= partial "partials/builders/boot-command" %> <%= partial "partials/builders/boot-command" %>
Example boot command. This is actually a working boot command used to start an The example shown below is a working boot command used to start an Ubuntu
Ubuntu 12.04 installer: 12.04 installer:
```text ``` json
[ [
"<esc><esc><enter><wait>", "<esc><esc><enter><wait>",
"/install/vmlinuz noapic ", "/install/vmlinuz noapic ",
@ -285,31 +296,34 @@ Ubuntu 12.04 installer:
] ]
``` ```
For more examples of various boot commands, see the sample projects from our
[community templates page](/community-tools.html#templates).
## Integration Services ## Integration Services
Packer will automatically attach the integration services iso as a dvd drive Packer will automatically attach the integration services ISO as a DVD drive
for the version of Hyper-V that is running. for the version of Hyper-V that is running.
## Generation 1 vs Generation 2 ## Generation 1 vs Generation 2
Floppy drives are no longer supported by generation 2 machines. This requires Floppy drives are no longer supported by generation 2 machines. This requires
you to take another approach when dealing with preseed or answer files. Two you to take another approach when dealing with preseed or answer files. Two
possible options are using virtual dvd drives or using the built in web possible options are using virtual DVD drives or using Packers built in web
server. server.
When dealing with Windows you need to enable UEFI drives for generation 2 When dealing with Windows you need to enable UEFI drives for generation 2
virtual machines. virtual machines.
## Creating iso from directory ## Creating an ISO From a Directory
Programs like mkisofs can be used to create an iso from a directory. There is Programs like mkisofs can be used to create an ISO from a directory. There is
a [windows version of a [windows version of
mkisofs](http://opensourcepack.blogspot.co.uk/p/cdrtools.html). mkisofs](http://opensourcepack.blogspot.co.uk/p/cdrtools.html) available.
Example powershell script. This is an actually working powershell script used Below is a working PowerShell script that can be used to create a Windows
to create a Windows answer iso: answer ISO:
```text ``` powershell
$isoFolder = "answer-iso" $isoFolder = "answer-iso"
if (test-path $isoFolder){ if (test-path $isoFolder){
remove-item $isoFolder -Force -Recurse remove-item $isoFolder -Force -Recurse
@ -343,54 +357,56 @@ if (test-path $isoFolder){
} }
``` ```
## Example For Windows Server 2012 R2 Generation 2 ## Example For Windows Server 2012 R2 Generation 2
Packer config: Packer config:
```javascript ``` json
{ {
"builders": [ "builders": [
{ {
"vm_name":"windows2012r2", "vm_name":"windows2012r2",
"type": "hyperv-iso", "type": "hyperv-iso",
"disk_size": 61440, "disk_size": 61440,
"floppy_files": [], "floppy_files": [],
"secondary_iso_images": [ "secondary_iso_images": [
"./windows/windows-2012R2-serverdatacenter-amd64/answer.iso" "./windows/windows-2012R2-serverdatacenter-amd64/answer.iso"
], ],
"http_directory": "./windows/common/http/", "http_directory": "./windows/common/http/",
"boot_wait": "0s", "boot_wait": "0s",
"boot_command": [ "boot_command": [
"a<wait>a<wait>a" "a<wait>a<wait>a"
], ],
"iso_url": "http://download.microsoft.com/download/6/2/A/62A76ABB-9990-4EFC-A4FE-C7D698DAEB96/9600.16384.WINBLUE_RTM.130821-1623_X64FRE_SERVER_EVAL_EN-US-IRM_SSS_X64FREE_EN-US_DV5.ISO", "iso_url": "http://download.microsoft.com/download/6/2/A/62A76ABB-9990-4EFC-A4FE-C7D698DAEB96/9600.16384.WINBLUE_RTM.130821-1623_X64FRE_SERVER_EVAL_EN-US-IRM_SSS_X64FREE_EN-US_DV5.ISO",
"iso_checksum_type": "md5", "iso_checksum_type": "md5",
"iso_checksum": "458ff91f8abc21b75cb544744bf92e6a", "iso_checksum": "458ff91f8abc21b75cb544744bf92e6a",
"communicator":"winrm", "communicator":"winrm",
"winrm_username": "vagrant", "winrm_username": "vagrant",
"winrm_password": "vagrant", "winrm_password": "vagrant",
"winrm_timeout" : "4h", "winrm_timeout" : "4h",
"shutdown_command": "f:\\run-sysprep.cmd", "shutdown_command": "f:\\run-sysprep.cmd",
"ram_size": 4096, "ram_size": 4096,
"cpu": 4, "cpu": 4,
"generation": 2, "generation": 2,
"switch_name":"LAN", "switch_name":"LAN",
"enable_secure_boot":true "enable_secure_boot":true
}], }
"provisioners": [{ ],
"type": "powershell", "provisioners": [
"elevated_user":"vagrant", {
"elevated_password":"vagrant", "type": "powershell",
"scripts": [ "elevated_user":"vagrant",
"./windows/common/install-7zip.ps1", "elevated_password":"vagrant",
"./windows/common/install-chef.ps1", "scripts": [
"./windows/common/compile-dotnet-assemblies.ps1", "./windows/common/install-7zip.ps1",
"./windows/common/cleanup.ps1", "./windows/common/install-chef.ps1",
"./windows/common/ultradefrag.ps1", "./windows/common/compile-dotnet-assemblies.ps1",
"./windows/common/sdelete.ps1" "./windows/common/cleanup.ps1",
] "./windows/common/ultradefrag.ps1",
}], "./windows/common/sdelete.ps1"
]
}
],
"post-processors": [ "post-processors": [
{ {
"type": "vagrant", "type": "vagrant",
@ -403,7 +419,7 @@ Packer config:
autounattend.xml: autounattend.xml:
```xml ``` xml
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"> <unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE"> <settings pass="windowsPE">
@ -800,12 +816,11 @@ Finish Setup cache proxy during installation -->
</settings> </settings>
<cpi:offlineImage cpi:source="wim:c:/projects/baseboxes/9600.16384.winblue_rtm.130821-1623_x64fre_server_eval_en-us-irm_sss_x64free_en-us_dv5_slipstream/sources/install.wim#Windows Server 2012 R2 SERVERDATACENTER" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> <cpi:offlineImage cpi:source="wim:c:/projects/baseboxes/9600.16384.winblue_rtm.130821-1623_x64fre_server_eval_en-us-irm_sss_x64free_en-us_dv5_slipstream/sources/install.wim#Windows Server 2012 R2 SERVERDATACENTER" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend> </unattend>
``` ```
sysprep-unattend.xml: sysprep-unattend.xml:
```text ``` xml
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"> <unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="generalize"> <settings pass="generalize">
@ -874,7 +889,7 @@ virtual switch with an `External` connection type.
### Packer config: ### Packer config:
```javascript ``` json
{ {
"variables": { "variables": {
"vm_name": "ubuntu-xenial", "vm_name": "ubuntu-xenial",
@ -886,45 +901,46 @@ virtual switch with an `External` connection type.
"iso_checksum": "DE5EE8665048F009577763EFBF4A6F0558833E59" "iso_checksum": "DE5EE8665048F009577763EFBF4A6F0558833E59"
}, },
"builders": [ "builders": [
{ {
"vm_name":"{{user `vm_name`}}", "vm_name":"{{user `vm_name`}}",
"type": "hyperv-iso", "type": "hyperv-iso",
"disk_size": "{{user `disk_size`}}", "disk_size": "{{user `disk_size`}}",
"guest_additions_mode": "disable", "guest_additions_mode": "disable",
"iso_url": "{{user `iso_url`}}", "iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}", "iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}", "iso_checksum": "{{user `iso_checksum`}}",
"communicator":"ssh", "communicator":"ssh",
"ssh_username": "packer", "ssh_username": "packer",
"ssh_password": "packer", "ssh_password": "packer",
"ssh_timeout" : "4h", "ssh_timeout" : "4h",
"http_directory": "./", "http_directory": "./",
"boot_wait": "5s", "boot_wait": "5s",
"boot_command": [ "boot_command": [
"<esc><wait10><esc><esc><enter><wait>", "<esc><wait10><esc><esc><enter><wait>",
"set gfxpayload=1024x768<enter>", "set gfxpayload=1024x768<enter>",
"linux /install/vmlinuz ", "linux /install/vmlinuz ",
"preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/hyperv-taliesins.cfg ", "preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/hyperv-taliesins.cfg ",
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
"hostname={{.Name}} ", "hostname={{.Name}} ",
"fb=false debconf/frontend=noninteractive ", "fb=false debconf/frontend=noninteractive ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA console-setup/ask_detect=false <enter>", "keyboard-configuration/variant=USA console-setup/ask_detect=false <enter>",
"initrd /install/initrd.gz<enter>", "initrd /install/initrd.gz<enter>",
"boot<enter>" "boot<enter>"
], ],
"shutdown_command": "echo 'packer' | sudo -S -E shutdown -P now", "shutdown_command": "echo 'packer' | sudo -S -E shutdown -P now",
"ram_size": "{{user `ram_size`}}", "ram_size": "{{user `ram_size`}}",
"cpu": "{{user `cpu`}}", "cpu": "{{user `cpu`}}",
"generation": 2, "generation": 2,
"enable_secure_boot": false "enable_secure_boot": false
}] }
]
} }
``` ```
### preseed.cfg: ### preseed.cfg:
```text ``` text
## Options to set on the command line ## Options to set on the command line
d-i debian-installer/locale string en_US.utf8 d-i debian-installer/locale string en_US.utf8
d-i console-setup/ask_detect boolean false d-i console-setup/ask_detect boolean false