Setting VM name or description from Vagrantfile ? #1126

Closed
Adirelle opened this Issue Sep 14, 2012 · 10 comments

Projects

None yet

10 participants

@Adirelle

Would it be possible to have some options in Vagrantfile to modify the name template used by vagrant when creating the VM ? This would help finding the VM from different projects in the VirtualBox Manager GUI.

This could be handy since VirtualBox 4.2 eventually allow to manage headless VMs.

(By the way, an option to push the actual port forwarding and shared folder settings into the VM description could be very useful.)

@ryanneufeld

+1 for this.

@axsuul
axsuul commented Sep 16, 2012

In the meantime, you can set the name manually like this

config.vm.customize ["modifyvm", :id, "--name", "Gangnam Style"]
@ghuntley

+1

@frankscholten

+1

@juozasg
juozasg commented Dec 3, 2012

+1

@mitchellh
Owner

Finally shipped this. Vagrant 1.1 offers a great framework for making provider-specific changes like this. In 1.1 Vagrantfile syntax this will look like this:

Vagrant.configure("2") do |config|
  # ... stuff

  config.vm.provider :virtualbox do |vb|
    vb.name = "my_machine"
  end
end

Enjoy! Will be available in 1.1.

@mitchellh mitchellh closed this Jan 31, 2013
@kris-o3
kris-o3 commented Feb 3, 2014

figured out how to manage to do this with individually-named vm's (multi-vm setup)...

# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

    config.vm.define "centos" do |centos|
        centos.vm.box = "centos"
        config.vm.provider :virtualbox do |vb|
            vb.name = "centos"
        end
    end

end
@MeanEYE
MeanEYE commented Aug 21, 2014

Sorry for bringing attention to this old issue. I am considering of dynamically naming VM the same name as parent directory. Are there any downsides to this?

@kikitux
Collaborator
kikitux commented Aug 21, 2014

Mailing list is best suited for these questions.

no downsides, just avoid duplicates.

@MeanEYE
MeanEYE commented Aug 21, 2014

Okay sorry. Quick search turned this relevant thread up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment