5

I've been using vagrant for provisioning virtual machines (Linux only) and so far I've been happy with it. The two things I dislike about it - the hardcoded dependency on the user vagrant as well as making the very first interface a virtual box NAT - this causes some routing problems when communicating outside my LAN - it has eth0 created by vagrant and eth1 in bridged mode. As far as I understand, this was a design decision so there is no way around it.

I currently use vagrant

  • To create a Virtual Box virtual machine,
  • Set Static IP/MAC addresses
  • Create my own secondary user, and then treat it as a standalone "physical" host. I then use this user for any additional provisioning.

I can delete the user vagrant - the problem is that if I do vagrant up (or vagrant halt I believe to gracefully shutdown) it tries to ssh and the command hangs while it retries. The other problem is that I need to delete it each time I spin up a VM and I cannot when doing the first time provisioning because I am logged in as user vagrant.

I've been wondering if there is any other similar software/tool that just does a one time provision, sets up a static IP/MAC address, and allows for easy start/resume/shutdown when testing/deploying/maintaining.

I've been looking at Hashicorp's packer but I don't think it is possible to automatically configure IP/MAC addresses.

I am mainly looking for creating a virtual machine from scratch as if it was installed on a bare metal desktop computer by hand using a ISO on a CD.

In the end, using packer to provision and then using VirtualBox command line tools to recreate some of the functionality that vagrant does will suffice (sett IP/MAC address) - but I wonder if there are any other tools used for creating secure (no vagrant user and ssh only with private key) vms.

Nakilon
  • 544
  • 3
  • 7
keyboard
  • 73
  • 4

3 Answers3

2

Have you considered to use Ansible?

You have some resources about using Ansible with VirtualBox and also vagrant

wolmi
  • 248
  • 2
  • 8
1

I've been wondering if there is any other similar software/tool that just does a one time provision, sets up a static IP/MAC address, and allows for easy start/resume/shutdown when testing/deploying/maintaining.

Sure... a virtualbox VM is simply a XML file. You can copy/modify it as such easily. Use vboxmanage to clone the hdd images as necessary.

So, I don't think it would be too far fetched to just create a template VM in virtualbox once, and then use a little script to do the rest. This way, you have complete control over everything. As you are using Ansible to provision the fresh VM anyway, you don't lose that much by ditching Vagrant.

AnoE
  • 4,936
  • 14
  • 26
0

This is targeted for something a little more industrial strength, but have you looked at Foreman? I use the Foreman bootdisk plugin to provision my VMs and bare metal machines via kickstart using iPXE. You will need a DHCP server for that though...

James Shewey
  • 3,752
  • 1
  • 17
  • 38