cannot use the box created with packer post-processor vagrant - vagrant

I followed the tutorial on packer.io to create a vagrant box from an amazon-ebs backed instance : https://www.packer.io/intro.
Only issue, the created .box file only contains a Vagrantfile and metadata.json, but I cannot find out how to use this in vagrant with virtualbox since all other boxes I have seen (among them hashcorp/precise32) have a .vmdk and .ovf file and mine doesn't !! Anyone has followed the tutorial and can advise me ? Thanks,

I think I found out : the vagrant box created for post-processing is meant to be used with the vagrant-aws plugin, not with virtualbox.
The provider is then "aws" and not "virtualbox", hence why I do not get the .vmdk and .ovf files. The aws-plugin is only to boot and provision EC2 instances, where as what I wanted to do was to "capture" the Amazon minimal linux interface in order to test it locally (cannot find a bloody iso file for it).
I must then surrender, packer.io was my last hope : I cannot find a way to set-up a VM with the minimal amazon linux image running...

Related

Vagrant box setup

I am trying to setup Hyperledger fabric on my Windows 7 machine. I installed all the prerequisite for environment setup like: Go, Oracle VM, Vagrant.
I cloned the fabric folder from hyperledger site. While trying to run vagrant up, it throws me error like:
connection aborted ,Retrying ....
It took SSH user name as: ubuntu and SSH password: password
I followed the steps from link1 and link2 for my setup.
Can any one suggest me how to solve this problem?
It would be great help for me if anyone share some solutions.
Please find the error screenshot for your reference.
Have you tried the docker setup? Seems to be the recommenced development environment.
To answer your question, Vagrant wants to use SSH keys for password-less access by default. Your Vagrantfile should point to SSH keys to use. Since you're on Windows you may need to generate these keys.

How to run official elasticsearch vagrant boxes

Where can I find documentation for elasticsearch vagrant boxes? Or how should I use them?
Boxes: https://atlas.hashicorp.com/elastic
I did execute these vagrant commands:
vagrant init elastic/ubuntu-16.04-x86_64
vagrant up --provider virtualbox
Expected elastic search to be running inside virtual box.
Expected elastic search to be running inside virtual box
yep, why ? Its nowhere said that elasticsearch will be running in the VM (and if running, which version, which setup) - although it might be cool
Those boxes are mainly used for elastic (as the company) to run their own test. You find more information about that in their github repo
https://github.com/elastic/elasticsearch/blob/master/TESTING.asciidoc#testing-scripts
and an example of the Vagrantfile they're using
https://github.com/elastic/elasticsearch/blob/master/Vagrantfile

Is it possible to enable WinRM in a Modern.ie VM or Vagrant Box by repackaging it with Packer?

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?
What you asked is described in Step 4
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
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.

Convert vhd to vagrant box?

I have a number of windows VMs running on my hyper-v instance I want to turn into vagrant boxes. Its there a tool out there that can do this for me or a clear guide on what needs to be enabled on the machine and how to create the config files that go into the box?
The documentation for windows VMs coming from hyper-v seem to be lacking with most guides focusing on virtual box.
TIA
There is no direct approach to achieve what you want.
NOTE: remove the hyper-v integration tools (agent, PV drivers etc...).
First, you need to convert VHD to VMDK or VDI format using VBoxManage, for example from VHD to VDI -> VBoxManage clonehd source.vhd target.vdi --format VDI
Once done, create a VM in VirtualBox with a proper spec (# of vCPUs, Memory, etc.), use the existing converted .vdi file as its virtual disk.
Try to boot the VM and see if everything works as expected. Install the VirtualBox Guest Additions (recommended).
Configure the VM as per Vagrant Documentation (e.g. NAT port forwarding rules, disabling UAC etc., refer to Creating a Base Box)
Package it as Vagrant box vagrant package --base vbox_vm_name --output /file/to/name.box

Vagrant creating another VM instead of boot up the default VM

I'm using Vagrant on Windows to create my dev environment. But today when I start it with the command vagrant up, it created another VM instead of using the one I always used it.
Looking in the folder C:/Users/My_User/VirtualBox VMs I found the default VM files.
How to proced to make Vagrant recognize this default VM?
PS: Sorry for my bad english!

Resources