7

Is there an established way to take a Vagrant box and use it as the operating system for a "bare metal" machine, i.e. a normal computer and not a hypervisor, without having to sit through an installation process?

Now I understand the common response will probably be "install an OS regularly and then use a proper configuration management tool like Puppet or Chef" but hear me out. Our IT organization would like to create a base Vagrant box with all security-related protocols and applications enforced. Then a configuration management tool like Puppet could install "useful" applications like databases and web servers on top of it.

This works best when a software developer wants to deploy a new utility to development environments or servers - they can write the Puppet code to install exactly what they want, which can be turned over to IT to run it on top of the validated Vagrant box to create a virtual machine server.

By hosting the Vagrant box internally, we can hide the security details from the developer while they write new Puppet code, they can test their Puppet code on the same environment they will run it on, and it will provision much faster during testing since the box is just downloaded once. Most "production" deployments will stay as Virtual Machines.

In rare circumstances, we may want a real, bare-metal server, not a VM, probably when we get new hardware to run more VMs or if the utility we need is very computationally intensive. It would be nice if the existing Vagrant box could be repurposed so bare-metal and virtual servers were indistinguishable.

EDIT: I found a post on askubuntu (https://askubuntu.com/questions/32499/migrate-from-a-virtual-machine-vm-to-a-physical-system) which seems to do what I want, can anyone verify if such a procedure would work on a Vagrant disk image, if there would be necessary cleanup (like Vagrant ssh keys) or if it could be generalized to non-Ubuntu operating systems (since it uses Live CD)?

Community
  • 1
  • 1
codingking
  • 71
  • 1
  • 4

1 Answers1

3

A Vagrant box packaged for VirtualBox is essentially a virtual disk with metadata. Most likely it's going to have the VirtualBox tools and drivers installed, which won't do much good on a physical system. Not only that, the drivers for the physical system would need to be installed on the box image.

What you're talking about doing is a good use case for some sort of "ghosting" software that simply copies blocks of data to a physical disk. There's really no advantage to using Vagrant here that I can see.

  • Vagrant can be used with VMware as the provider. With a beefy enough server, you could provision lots of VMs on a single physical machine using Vagrant. But you'd still need separate Vagrant box files for VMware and VirtualBox. –  Dec 24 '14 at 19:56
  • 1
    So the best thing to do would be to use Vagrant for debugging domain-specific Puppet code and running virtual servers against a common IT-security compliant Box, then (whenever a physical machine is needed) do a fresh OS install, implement IT-security from scratch (possibly with Puppet) and then provision domain-specific things on top of that? – codingking Dec 24 '14 at 20:04
  • If possible, I would avoid doing anything bare metal and standardize on a virtualization platform. You could use Vagrant with VMware for development, then use that same Vagrant box to provision the production virtual machines which would run on high quality hardware. –  Dec 24 '14 at 20:09