1

There are these free like free beer virtual machines (VM) from Microsoft which one can download from modern.ie and use for testing or whatever. And there is this nice Gist on Github which explains how to enable WinRM support on that VMs. Unfortunately this requires manual interaction with the VM after initial boot up (step 2. in Gist). Is it possible to let Packer do this job using it´s builder type virtualbox-ovf (VIRTUALBOX BUILDER (FROM AN OVF/OVA))? If it is possible can you provide some example code, please.

Or asked another way: How to create a Vagrant Box from an existing VirtualBox image (.ova file) or from an existing Vagrant Box (.ovffile) with Packer?

Wlad
  • 2,866
  • 3
  • 28
  • 42

2 Answers2

0

What you asked is described in Step 4

  1. Package

Since there's a lot of Windows specific configuration, you can include the Vagrantfile in the package command so winrm and virtualbox configuration get's default values when the repackaged is used for other purposes. Remember to run the command in the same directory the Vagrantfile resides:

$ vagrant package --output "yourboxname" --Vagrantfile Vagrantfile

After that you're all set!

once you complete step2 and 3, you will run step4 which recreate a vagrant box from the updated VM and you can re-use this box

Or asked another way: How to create a Vagrant Box from an existing VirtualBox image (.ova file) or from an existing Vagrant Box (.ovffile) with Packer?

This is not possible, shortly speaking, packer creates Vagrant box from OS ISO distribution, not from existing VM

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139
  • But Packer docs say this: ["This VirtualBox Packer builder is able to create VirtualBox virtual machines and export them in the OVF format, starting from an existing OVF/OVA (exported virtual machine image)."](https://www.packer.io/docs/builders/virtualbox-ovf.html) Note the **" starting from an existing OVF/OVA"** part. Do I get something wrong? – Wlad Aug 23 '16 at 12:24
  • ok looks like you're right - not sure whats the use case vs [vagrant package](https://www.vagrantup.com/docs/cli/package.html); anyway I have always considered `vagrant box repackage` as my option to recreate a vagrant box from existing VM initially created from vagrant – Frederic Henri Aug 23 '16 at 12:30
0

You can connect to Windows modern.ie VM with ssh (Openssh service runs at startup). You'll have a very limited shell, but enough to call cmd.exe or powershell, and activate WinRM. On Windows 10 VM, you just have to change the network type to something not public. That's it.