2016-08-11 49 views
1

我有3个无业游民盒SSH连接到特定的流浪汉框,而不是默认的一个

vagrant box list 

hashicorp/precise32 (virtualbox, 1.0.0) 
hashicorp/precise64 (vmware_fusion, 1.1.0) 
laravel/homestead (virtualbox, 0.4.2) 

当我做vagrant upvagrant ssh,我不停地登录到hashicorp/precise32机。

如何将ssh放入此框hashicorp/precise64

在项目目录

回答

1

流浪汉SSH {}主机


如果您在游民文件中声明3个虚拟机。

VAGRANTFILE_API_VERSION = "2" 

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 
    config.vm.define "lb01" do |lb01| 
    lb01.vm.box = "ubuntu/trusty64" 
    lb01.vm.hostname = "lb01" 
    lb01.vm.network :private_network, ip: "10.11.12.50" 
    end 

    config.vm.define "web01" do |web01| 
    web01.vm.box = "ubuntu/trusty64" 
    web01.vm.hostname = "web01" 
    web01.vm.network :private_network, ip: "10.11.12.51" 
    end 

    config.vm.define "web02" do |web02| 
    web02.vm.box = "ubuntu/trusty64" 
    web02.vm.hostname = "web02" 
    web02.vm.network :private_network, ip: "10.11.12.52" 
    end 
end 

然后,运行vagrant up后,我就可以vagrant ssh lb01我应该登录到lb01 VM。

1

,您已经定义了一个Vagrantfile,在这个Vagrantfile,你已经指出如果你想创建一个需要被用于你旋转的VM,像

Vagrant.configure("2") do 
    config.box = "hashicorp/precise32" 
end 

箱从hashicorp/precise64箱新的虚拟机,你需要有

Vagrant.configure("2") do 
    config.box = "hashicorp/precise64" 
end 

,以确保你不删除任何东西,只需要创建一个新的文件夹和一个新的Vagrantfile。旋转起来的新实例做

vagrant up --provider vmware_fusion