Skip to content

Vagrant: Give Virtualbox VMs a name

until now, even if vagrant nodes have a name, they appear in vboxmanage like this:

testbot@greyhound:~/vagrant_test$ vboxmanage list vms
"test_1368023737" {ef4db20d-eda9-4ebf-9050-97978939c660}

adding the 'config.vm.provider "virtualbox" do |v|' section to a node like this:

  config.vm.define :rewire_dev_vpn1 do |config|
    config.vm.box = "leap-wheezy"
    config.vm.box_url = "http://download.leap.se/leap-debian.box"
    config.vm.network :private_network, ip: "10.5.5.80"

    config.vm.provider "virtualbox" do |v|
      v.name = "rewire_dev_vpn1"
    end

  end

will give the virtualbox VM the same name as it has in vagrant:

testbot@greyhound:~/vagrant_test$ vboxmanage list vms
"rewire_dev_vpn1" {88dd4589-8279-4069-adc7-20a177cd3005}

Especially on scenarios like CI on greyhound, it would help a lot to distinguish between the different VMs more easily.

(from redmine: created on 2013-05-12, closed on 2013-07-26, relates #2523 (closed), relates #3241 (closed), relates #4182 (closed))