Giter Club home page Giter Club logo

packer-post-processor-virtualbox-to-hyperv's Introduction

Archived

See #3 (comment)


Download

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

  1. Download the plugin into the same directory as your packer executable.
  2. 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

packer-post-processor-virtualbox-to-hyperv's People

Contributors

dwickern avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

packer-post-processor-virtualbox-to-hyperv's Issues

Getting error, unknown artifact type

I'm getting this error when trying to convert to hyperv. "Post-processor failed: Unknown artifact type: mitchellh.post-processor.vagrant".

According to numerous other github issues,1 2 this can be caused by not nesting an array of post-processors. (AKA sequencing).
I've verified that the post-processors are sequenced.

  "post-processors": [
    [{
      "type": "vagrant",
      "keep_input_artifact": true,
      "output": "output-virtualbox-iso/win2012r2-{{.Provider}}.box",
      "vagrantfile_template": "vagrant/windows.template"
    }, {
      "type": "virtualbox-to-hyperv",
      "only": ["virtualbox-iso"],
      "output": "output_hyperv.box"
    }]
  ],
==> virtualbox-iso: Gracefully halting virtual machine...
    virtualbox-iso: Removing floppy drive...
==> virtualbox-iso: Preparing to export machine...
    virtualbox-iso: Deleting forwarded port mapping for the communicator (SSH, WinRM, etc) (host port 4107)
==> virtualbox-iso: Exporting virtual machine...
    virtualbox-iso: Executing: export packer-virtualbox-iso-1464749099 --output output-virtualbox-iso/packer-virtualbox-iso-1464749099.ovf
==> virtualbox-iso: Unregistering and deleting virtual machine...
==> virtualbox-iso: Running post-processor: vagrant
==> virtualbox-iso (vagrant): Creating Vagrant box for 'virtualbox' provider
    virtualbox-iso (vagrant): Copying from artifact: output-virtualbox-iso/packer-virtualbox-iso-1464749099-disk1.vmdk
    virtualbox-iso (vagrant): Copying from artifact: output-virtualbox-iso/packer-virtualbox-iso-1464749099.ovf
    virtualbox-iso (vagrant): Renaming the OVF to box.ovf...
    virtualbox-iso (vagrant): Using custom Vagrantfile: vagrant/windows.template
    virtualbox-iso (vagrant): Compressing: Vagrantfile
    virtualbox-iso (vagrant): Compressing: box.ovf
    virtualbox-iso (vagrant): Compressing: metadata.json
    virtualbox-iso (vagrant): Compressing: packer-virtualbox-iso-1464749099-disk1.vmdk
==> virtualbox-iso: Running post-processor: virtualbox-to-hyperv
Build 'virtualbox-iso' errored: 1 error(s) occurred:

* Post-processor failed: Unknown artifact type: mitchellh.post-processor.vagrant
Can only import from virtualbox artifacts.

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: 1 error(s) occurred:

* Post-processor failed: Unknown artifact type: mitchellh.post-processor.vagrant
Can only import from virtualbox artifacts.

==> Builds finished but no artifacts were created.

https://www.packer.io/docs/templates/post-processors.html

Any suggestions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.