Archived
See https://github.com/dwickern/packer-post-processor-virtualbox-to-hyperv/pull/3#issuecomment-1964501035
Packer post-processor: VirtualBox to Hyper-V
A packer plugin to create Hyper-V vagrant boxes from VirtualBox artifacts.
You can use this plugin without having Hyper-V installed.
Usage
Add the plugin to your packer template:
{
"builders": [
{
"type": "vmware-iso", ...
},
{
"type": "virtualbox-iso", ...
}
],
"post-processors": [
{
"type": "vagrant",
"output": "output_{{.Provider}}.box",
},
{
"type": "virtualbox-to-hyperv",
"only": ["virtualbox-iso"],
"output": "output_hyperv.box"
}
]
}
This would generate a vagrant box for vmware, virtualbox and hyperv providers
In order for a box to work in Hyper-V, the guest VM will need Hyper-V integration tools installed. Otherwise, vagrant will not be able to determine the guest's IP address.
For some real examples, see packer templates for Windows 2008 R2 and Ubuntu 14.04.
Configuration
This plugin extends the Vagrant post-processor and accepts the same configuration options.
It also accepts this additional configuration:
vm_name
(string) - the name of the virtual machine displayed in Hyper-V Manager.
By default this is "packer-BUILDNAME", where "BUILDNAME" is the name of the build.
Can be changed in the Vagrantfile by setting vmname in the hyperv provider.
Installation
- Download the plugin into the same directory as your packer executable.
- Add the plugin to
~/.packerconfig
or %APPDATA%\packer.config
on Windows:
{
"post-processors": {
"virtualbox-to-hyperv": "packer-post-processor-virtualbox-to-hyperv"
}
}
See also Installing Plugins.
Credits
Based on MSOpenTech/packer-hyperv using the techniques described in Creating a Hyper-V Vagrant box from a VirtualBox vmdk or vdi image