带有 Azure 提供程序的多个盒子
Multiple boxes with Azure provider
我正在使用 Azure provider for Vagrant 并尝试创建 2 个相同的虚拟机。
Vagrant.configure('2') do |config|
v1 = 2
config.vm.box = 'azure'
v1.times do |i|
config.vm.provider :azure do |azure, override|
azure.resource_group_name = "random-#{i}"
end
end
end
这确实在 Azure 中创建了一个 VM,但只有一个。有什么想法吗?
即使您使用 .times
方法进行循环,您仍然会创建单个 VM,每次在循环中迭代时都需要创建每个 VM。使用 config.vm.define
方法调用创建了一台新机器(参见 vagrant multi machine doc)
Vagrant.configure('2') do |config|
v1 = 2
config.vm.box = 'azure'
v1.times do |i|
config.vm.define "random-#{i}" do |node|
node.vm.provider :azure do |azure, override|
azure.resource_group_name = "random-#{i}"
end
end
end
end
我正在使用 Azure provider for Vagrant 并尝试创建 2 个相同的虚拟机。
Vagrant.configure('2') do |config|
v1 = 2
config.vm.box = 'azure'
v1.times do |i|
config.vm.provider :azure do |azure, override|
azure.resource_group_name = "random-#{i}"
end
end
end
这确实在 Azure 中创建了一个 VM,但只有一个。有什么想法吗?
即使您使用 .times
方法进行循环,您仍然会创建单个 VM,每次在循环中迭代时都需要创建每个 VM。使用 config.vm.define
方法调用创建了一台新机器(参见 vagrant multi machine doc)
Vagrant.configure('2') do |config|
v1 = 2
config.vm.box = 'azure'
v1.times do |i|
config.vm.define "random-#{i}" do |node|
node.vm.provider :azure do |azure, override|
azure.resource_group_name = "random-#{i}"
end
end
end
end