reformat docs
This commit is contained in:
parent
d8c6e6d4a4
commit
5937f75898
|
@ -2,6 +2,7 @@
|
|||
description: |-
|
||||
The Hyper-V Packer builder is able to clone an existing Hyper-V virtual machine and export them.
|
||||
layout: "docs"
|
||||
sidebar_current: 'docs-builders-hyperv-vmcx'
|
||||
page_title: "Hyper-V Builder (from an vmcx)"
|
||||
---
|
||||
|
||||
|
@ -25,10 +26,11 @@ OS installer but then fail because we don't provide the preseed file for
|
|||
Ubuntu to self-install. Still, the example serves to show the basic configuration:
|
||||
|
||||
Import from folder:
|
||||
```javascript
|
||||
|
||||
```json
|
||||
{
|
||||
"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",
|
||||
"ssh_username": "packer",
|
||||
"ssh_password": "packer",
|
||||
"shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
|
||||
|
@ -36,13 +38,14 @@ Import from folder:
|
|||
```
|
||||
|
||||
Clone from existing virtual machine:
|
||||
```javascript
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "hyperv-vmcx",
|
||||
"clone_from_vm_name": "ubuntu-12.04.5-server-amd64",
|
||||
"ssh_username": "packer",
|
||||
"ssh_password": "packer",
|
||||
"shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
|
||||
"clone_from_vm_name": "ubuntu-12.04.5-server-amd64",
|
||||
"shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
|
||||
"ssh_password": "packer",
|
||||
"ssh_username": "packer",
|
||||
"type": "hyperv-vmcx"
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -61,73 +64,78 @@ In addition to the options listed here, a
|
|||
can be configured for this builder.
|
||||
|
||||
### Required for virtual machine import:
|
||||
- `clone_from_vmxc_path` (string) - The path to the exported
|
||||
virtual machine folder.
|
||||
|
||||
- `clone_from_vmxc_path` (string) - The path to the exported virtual machine
|
||||
folder.
|
||||
|
||||
### Required for virtual machine clone:
|
||||
- `clone_from_vm_name` (string) - The name of the vm to clone from.
|
||||
Ideally the machine to clone from should be shutdown.
|
||||
|
||||
- `clone_from_vm_name` (string) - The name of the vm to clone from. Ideally
|
||||
the machine to clone from should be shutdown.
|
||||
|
||||
### Optional:
|
||||
- `clone_from_snapshot_name` (string) - The name of the snapshot
|
||||
|
||||
- `clone_all_snapshots` (boolean) - Should all snapshots be cloned
|
||||
when the machine is cloned.
|
||||
- `clone_from_snapshot_name` (string) - The name of the snapshot
|
||||
|
||||
- `boot_command` (array of strings) - This is an array of commands to type
|
||||
- `clone_all_snapshots` (boolean) - Should all snapshots be cloned when the
|
||||
machine is cloned.
|
||||
|
||||
- `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.
|
||||
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
|
||||
- `boot_wait` (string) - The time to wait after booting the initial virtual
|
||||
machine before typing the `boot_command`. The value of this should be
|
||||
a duration. Examples are "5s" and "1m30s" which will cause Packer to wait
|
||||
five seconds and one minute 30 seconds, respectively. If this isn't specified,
|
||||
the default is 10 seconds.
|
||||
five seconds and one minute 30 seconds, respectively. If this isn't
|
||||
specified, the default is 10 seconds.
|
||||
|
||||
- `cpu` (integer) - The number of cpus the virtual machine should use. If this isn't specified,
|
||||
the default is 1 cpu.
|
||||
- `cpu` (integer) - The number of cpus the virtual machine should use. If
|
||||
this isn't specified, the default is 1 cpu.
|
||||
|
||||
- `enable_dynamic_memory` (bool) - If true enable dynamic memory for virtual machine.
|
||||
This defaults to false.
|
||||
- `enable_dynamic_memory` (bool) - If true enable dynamic memory for virtual
|
||||
machine. This defaults to false.
|
||||
|
||||
- `enable_mac_spoofing` (bool) - If true enable mac spoofing for virtual machine.
|
||||
This defaults to false.
|
||||
- `enable_mac_spoofing` (bool) - If true enable mac spoofing for virtual
|
||||
machine. This defaults to false.
|
||||
|
||||
- `enable_secure_boot` (bool) - If true enable secure boot for virtual machine.
|
||||
This defaults to false.
|
||||
- `enable_secure_boot` (bool) - If true enable secure boot for virtual
|
||||
machine. This defaults to false.
|
||||
|
||||
- `enable_virtualization_extensions` (bool) - If true enable virtualization extensions for 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 for virtual machine.
|
||||
- `enable_virtualization_extensions` (bool) - If true enable virtualization
|
||||
extensions for 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 for virtual machine.
|
||||
|
||||
- `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_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_dirs` (array of strings) - A list of directories to place onto
|
||||
the floppy disk recursively. This is similar to the `floppy_files` option
|
||||
- `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`.
|
||||
|
||||
- `guest_additions_mode` (string) - How should guest additions be installed.
|
||||
If value `attach` then attach iso image with by specified by `guest_additions_path`.
|
||||
Otherwise guest additions is not installed.
|
||||
- `guest_additions_mode` (string) - How should guest additions be installed.
|
||||
If value `attach` then attach iso image with by specified by
|
||||
`guest_additions_path`. Otherwise guest additions is not installed.
|
||||
|
||||
- `guest_additions_path` (string) - The path to the iso image for guest additions.
|
||||
- `guest_additions_path` (string) - The path to the iso image for guest
|
||||
additions.
|
||||
|
||||
- `http_directory` (string) - Path to a directory to serve using an HTTP
|
||||
- `http_directory` (string) - Path to a directory to serve using an HTTP
|
||||
server. The files in this directory will be available over HTTP that will
|
||||
be requestable from the virtual machine. This is useful for hosting
|
||||
kickstart files and so on. By default this is "", which means no HTTP
|
||||
|
@ -135,86 +143,90 @@ can be configured for this builder.
|
|||
available as variables in `boot_command`. This is covered in more detail
|
||||
below.
|
||||
|
||||
- `http_port_min` and `http_port_max` (integer) - These are the minimum and
|
||||
maximum port to use for the HTTP server started to serve the `http_directory`.
|
||||
Because Packer often runs in parallel, Packer will choose a randomly available
|
||||
port in this range to run the HTTP server. If you want to force the HTTP
|
||||
server to be on one port, make this minimum and maximum port the same.
|
||||
By default the values are 8000 and 9000, respectively.
|
||||
- `http_port_min` and `http_port_max` (integer) - These are the minimum and
|
||||
maximum port to use for the HTTP server started to serve the
|
||||
`http_directory`. Because Packer often runs in parallel, Packer will choose
|
||||
a randomly available port in this range to run the HTTP server. If you want
|
||||
to force the HTTP server to be on one port, make this minimum and maximum
|
||||
port the same. By default the values are 8000 and 9000, respectively.
|
||||
|
||||
- `iso_checksum` (string) - The checksum for the OS ISO file. Because ISO
|
||||
files are so large, this is required and Packer will verify it prior
|
||||
to booting a virtual machine with the ISO attached. The type of the
|
||||
checksum is specified with `iso_checksum_type`, documented below.
|
||||
- `iso_checksum` (string) - The checksum for the OS ISO file. Because ISO
|
||||
files are so large, this is required and Packer will verify it prior to
|
||||
booting a virtual machine with the ISO attached. The type of the checksum
|
||||
is specified with `iso_checksum_type`, documented below.
|
||||
|
||||
- `iso_checksum_type` (string) - The type of the checksum specified in
|
||||
- `iso_checksum_type` (string) - The type of the checksum specified in
|
||||
`iso_checksum`. Valid values are "none", "md5", "sha1", "sha256", or
|
||||
"sha512" currently. While "none" will skip checksumming, this is not
|
||||
recommended since ISO files are generally large and corruption does happen
|
||||
from time to time.
|
||||
|
||||
- `iso_url` (string) - A URL to the ISO containing the installation image.
|
||||
This URL can be either an HTTP URL or a file URL (or path to a file).
|
||||
If this is an HTTP URL, Packer will download iso and cache it between
|
||||
runs.
|
||||
- `iso_url` (string) - A URL to the ISO containing the installation image.
|
||||
This URL can be either an HTTP URL or a file URL (or path to a file). If
|
||||
this is an HTTP URL, Packer will download iso and cache it between runs.
|
||||
|
||||
- `iso_urls` (array of strings) - Multiple URLs for the ISO to download.
|
||||
Packer will try these in order. If anything goes wrong attempting to download
|
||||
or while downloading a single URL, it will move on to the next. All URLs
|
||||
must point to the same file (same checksum). By default this is empty
|
||||
and `iso_url` is used. Only one of `iso_url` or `iso_urls` can be specified.
|
||||
- `iso_urls` (array of strings) - Multiple URLs for the ISO to download.
|
||||
Packer will try these in order. If anything goes wrong attempting to
|
||||
download or while downloading a single URL, it will move on to the next.
|
||||
All URLs must point to the same file (same checksum). By default this is
|
||||
empty and `iso_url` is used. Only one of `iso_url` or `iso_urls` can be
|
||||
specified.
|
||||
|
||||
- `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".
|
||||
|
||||
- `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
|
||||
original filename as its name.
|
||||
|
||||
- `output_directory` (string) - This is the path to the directory where the
|
||||
resulting virtual machine will be created. This may be relative or absolute.
|
||||
If relative, the path is relative to the working directory when `packer`
|
||||
is executed. This directory must not exist or be empty prior to running the builder.
|
||||
By default this is "output-BUILDNAME" where "BUILDNAME" is the name
|
||||
of the build.
|
||||
- `output_directory` (string) - This is the path to the directory where the
|
||||
resulting virtual machine will be created. This may be relative or
|
||||
absolute. If relative, the path is relative to the working directory when
|
||||
`packer` is executed. This directory must not exist or be empty prior to
|
||||
running the builder. By default this is "output-BUILDNAME" where
|
||||
"BUILDNAME" is the name of the build.
|
||||
|
||||
- `ram_size` (integer) - The size, in megabytes, of the ram to create
|
||||
for the VM. By default, this is 1 GB.
|
||||
- `ram_size` (integer) - The size, in megabytes, of the ram to create for the
|
||||
VM. By default, this is 1 GB.
|
||||
|
||||
* `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 Windows installs, which
|
||||
look for an `Autounattend.xml` file on removable media. By default, no
|
||||
secondary iso will be attached.
|
||||
* `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 Windows
|
||||
installs, which look for an `Autounattend.xml` file on removable media. By
|
||||
default, no secondary iso will be attached.
|
||||
|
||||
- `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 string, which tells Packer to just
|
||||
forcefully shut down the machine unless a shutdown command takes place inside script so this may
|
||||
safely be omitted. If one or more scripts require a reboot it is suggested to leave this blank
|
||||
since reboots may fail and specify the final shutdown command in your last script.
|
||||
- `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
|
||||
string, which tells Packer to just forcefully shut down the machine unless
|
||||
a shutdown command takes place inside script so this may safely be omitted.
|
||||
If one or more scripts require a reboot it is suggested to leave this blank
|
||||
since reboots may fail and 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 it doesn't shut down in this time, it is an error. By default, the timeout
|
||||
is "5m", or five minutes.
|
||||
- `shutdown_timeout` (string) - The amount of time to wait after executing
|
||||
the `shutdown_command` for the virtual machine to actually shut down. If it
|
||||
doesn't shut down in this time, it is an error. By default, the timeout is
|
||||
"5m", or five minutes.
|
||||
|
||||
- `skip_compaction` (bool) - If true skip compacting the hard disk for virtual machine when
|
||||
exporting. This defaults to false.
|
||||
- `skip_compaction` (bool) - If true skip compacting the hard disk for
|
||||
virtual machine when exporting. This defaults to false.
|
||||
|
||||
- `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 determine the switch to use by looking for
|
||||
external switch that is up and running.
|
||||
- `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
|
||||
determine the switch to use by looking for 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`.
|
||||
- `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`.
|
||||
|
||||
- `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.
|
||||
- `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 virtual machine for the new virtual
|
||||
machine, without the file extension. By default this is "packer-BUILDNAME",
|
||||
where "BUILDNAME" is the name of the build.
|
||||
- `vm_name` (string) - This is the name of the virtual machine for the new
|
||||
virtual machine, without the file extension. By default this is
|
||||
"packer-BUILDNAME", where "BUILDNAME" is the name of the build.
|
||||
|
||||
## Boot Command
|
||||
|
||||
|
@ -232,47 +244,47 @@ to the machine, simulating a human actually typing the keyboard. There are
|
|||
a set of special keys available. If these are in your boot command, they
|
||||
will be replaced by the proper key:
|
||||
|
||||
- `<bs>` - Backspace
|
||||
- `<bs>` - Backspace
|
||||
|
||||
- `<del>` - Delete
|
||||
- `<del>` - Delete
|
||||
|
||||
- `<enter>` and `<return>` - Simulates an actual "enter" or "return" keypress.
|
||||
- `<enter>` and `<return>` - Simulates an actual "enter" or "return" keypress.
|
||||
|
||||
- `<esc>` - Simulates pressing the escape key.
|
||||
- `<esc>` - Simulates pressing the escape key.
|
||||
|
||||
- `<tab>` - Simulates pressing the tab key.
|
||||
- `<tab>` - Simulates pressing the tab key.
|
||||
|
||||
- `<f1>` - `<f12>` - Simulates pressing a function key.
|
||||
- `<f1>` - `<f12>` - Simulates pressing a function key.
|
||||
|
||||
- `<up>` `<down>` `<left>` `<right>` - Simulates pressing an arrow key.
|
||||
- `<up>` `<down>` `<left>` `<right>` - Simulates pressing an arrow key.
|
||||
|
||||
- `<spacebar>` - Simulates pressing the spacebar.
|
||||
- `<spacebar>` - Simulates pressing the spacebar.
|
||||
|
||||
- `<insert>` - Simulates pressing the insert key.
|
||||
- `<insert>` - Simulates pressing the insert key.
|
||||
|
||||
- `<home>` `<end>` - Simulates pressing the home and end keys.
|
||||
- `<home>` `<end>` - Simulates pressing the home and end keys.
|
||||
|
||||
- `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys.
|
||||
- `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys.
|
||||
|
||||
- `<leftAlt>` `<rightAlt>` - Simulates pressing the alt key.
|
||||
- `<leftAlt>` `<rightAlt>` - Simulates pressing the alt key.
|
||||
|
||||
- `<leftCtrl>` `<rightCtrl>` - Simulates pressing the ctrl key.
|
||||
- `<leftCtrl>` `<rightCtrl>` - Simulates pressing the ctrl key.
|
||||
|
||||
- `<leftShift>` `<rightShift>` - Simulates pressing the shift key.
|
||||
- `<leftShift>` `<rightShift>` - Simulates pressing the shift key.
|
||||
|
||||
- `<leftAltOn>` `<rightAltOn>` - Simulates pressing and holding the alt key.
|
||||
- `<leftAltOn>` `<rightAltOn>` - Simulates pressing and holding the alt key.
|
||||
|
||||
- `<leftCtrlOn>` `<rightCtrlOn>` - Simulates pressing and holding the ctrl key.
|
||||
- `<leftCtrlOn>` `<rightCtrlOn>` - Simulates pressing and holding the ctrl key.
|
||||
|
||||
- `<leftShiftOn>` `<rightShiftOn>` - Simulates pressing and holding the shift key.
|
||||
- `<leftShiftOn>` `<rightShiftOn>` - Simulates pressing and holding the shift key.
|
||||
|
||||
- `<leftAltOff>` `<rightAltOff>` - Simulates releasing a held alt key.
|
||||
- `<leftAltOff>` `<rightAltOff>` - Simulates releasing a held alt key.
|
||||
|
||||
- `<leftCtrlOff>` `<rightCtrlOff>` - Simulates releasing a held ctrl key.
|
||||
- `<leftCtrlOff>` `<rightCtrlOff>` - Simulates releasing a held ctrl key.
|
||||
|
||||
- `<leftShiftOff>` `<rightShiftOff>` - Simulates releasing a held shift key.
|
||||
- `<leftShiftOff>` `<rightShiftOff>` - Simulates releasing a held shift key.
|
||||
|
||||
- `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before
|
||||
- `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before
|
||||
sending any additional keys. This is useful if you have to generally wait
|
||||
for the UI to update before typing more.
|
||||
|
||||
|
|
|
@ -111,6 +111,9 @@
|
|||
<li<%= sidebar_current("docs-builders-hyperv-iso") %>>
|
||||
<a href="/docs/builders/hyperv-iso.html">ISO</a>
|
||||
</li>
|
||||
<li<%= sidebar_current("docs-builders-hyperv-vmcx") %>>
|
||||
<a href="/docs/builders/hyperv-vmcx.html">VMCX</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li<%= sidebar_current("docs-builders-lxc") %>>
|
||||
|
|
Loading…
Reference in New Issue