Chaning VM ssh name

11 views
Skip to first unread message

Makrand

unread,
Jul 2, 2020, 10:04:36 AM7/2/20
to vagra...@googlegroups.com
Hi All,

Is there any way I can change the config name of VM....where one do vagrant ssh <VM_Name>?

I can change the hostname & VM name (displayed on VBOX) by editing and doing "vagrant reload". But if I do try to change name in config.vm.define, it just try to recreate the VM.

Here is vagrant file - 
(1..NodeCount).each do |i|
    config.vm.define "ubuntuvm0#{i}" do |node|
      node.vm.box = "ubuntu/bionic64"
      node.vm.hostname = "ubu18-#{i}"
      node.vm.network "private_network", ip: "10.0.0.10#{i}"
      node.vm.provider "virtualbox" do |v|
        v.name = "ubu18-#{i}"
        v.memory = 1024
        v.cpus = 1

If I change it to something like ubu18-#{i}, reload fails and up just try to create new VM.

makrand@mint-gl63:~/lab/vagrant/vagrantfiles/ubuntu18$ vagrant reload
==> ubu18-1: VM not created. Moving on...
==> ubu18-2: VM not created. Moving on...
==> ubu18-3: VM not created. Moving on...
makrand@mint-gl63:~/lab/vagrant/vagrantfiles/ubuntu18$ vi Vagrantfile
makrand@mint-gl63:~/lab/vagrant/vagrantfiles/ubuntu18$ vagrant up
Bringing machine 'ubu18-1' up with 'virtualbox' provider...
Bringing machine 'ubu18-2' up with 'virtualbox' provider...
Bringing machine 'ubu18-3' up with 'virtualbox' provider...
==> ubu18-1: Importing base box 'ubuntu/bionic64'...
Progress: 90%^C==> ubu18-1: Waiting for cleanup before exiting





--
Makrand

Jeff Bonhag

unread,
Jul 21, 2020, 11:05:54 AM7/21/20
to vagra...@googlegroups.com
Hi there,

Unfortunately it isn't possible to rename a running VM. I'd recommend destroying the machines with the old names, renaming the machines in your Vagrantfile, and then bringing up new machines with the new names.

Cheers,
Jeff

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/vagrant/issues
Discuss: https://discuss.hashicorp.com/c/vagrant/24
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CABdC_7kSEJSpk2zBckH3YF3_QvEJtp9roatc5aG8NOFT-77vBQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages