我正在使用Vagrant尝试在Azure云上制作盒子。 我正在使用Azure插件
我可以制作云服务“cloudservice1” 并将VM“box1”放入其中
我可以制作云服务“cloudservice2” 并将VM“box2”放入其中
当我在两个不同的Vagrantfiles上运行vagrant时 看起来像: cloudservice1包含box1 cloudservice2包含box2
但是,如果我尝试将两个Vagrantfiles部署到同一个云服务: 目标是使“cloudservice1”包含“box1”和“box2”
我遇到的问题是: “指定的部署位置生产已被占用”
我可以看到 “默认:添加角色? - false”
在运行vagrant时输出,我相信问题是我需要将其设置为True才能将另一个盒子添加到现有的云服务中。
我已经搜索了一段时间,似乎无法找到Azure + Vagrant的任何内容。 在DevOp,我被告知我可能需要打开Plug = in gem并更改该行所在的位置。
是否有替代方案或更好的解决方法?
由于 编辑: 我试过一个文件:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = 'azure'
config.vm.provision "fix-no-tty", type: "shell" do |s|
s.privileged = false
s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile"
end
do_common_azure_stuff = Proc.new do |azure, override|
azure.mgmt_certificate = "CERT LOCATION"
azure.mgmt_endpoint = 'https://management.core.windows.net'
azure.subscription_id = 'ID'
azure.storage_acct_name = 'dev1' # optional. A new one will be generated if not provided.
azure.vm_image = 'b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04-LTS-amd64-server-20140528-en-us-30GB'
azure.vm_user = 'USER' # defaults to 'vagrant' if not provided
azure.vm_password = 'PASSWORD'# min 8 characters. should contain a lower case letter, an uppercase letter, a number and a special character
azure.vm_name = "DEV"
azure.cloud_service_name = "DEV-test" # same as vm_name. leave blank to auto-generate
azure.deployment_name = "DevDeployment" # defaults to cloud_service_name
azure.vm_location = 'East US' # e.g., West US, Este de EE. UU.
end
config.ssh.username = 'USER' # modify this username
config.ssh.password = 'PASSWORD' # If windows or user/pass auth enabled
config.vm.define 'app1' do |cfg|
cfg.vm.provider :azure do |azure, override|
do_common_azure_stuff.call azure, override
azure.vm_name = 'app1-DEV'
end
end
config.vm.define 'app2' do |cfg|
cfg.vm.provider :azure do |azure, override|
do_common_azure_stuff.call azure, override
azure.vm_name = 'app2-DEV'
end
end
config.vm.define 'app3' do |cfg|
cfg.vm.provider :azure do |azure, override|
do_common_azure_stuff.call azure, override
azure.vm_name = 'app3-DEV'
end
end
end
在这种情况下,所有的盒子都以 [31m [1mConflictError:指定的部署位置生产被占用。[0m [0m
和两个文件 - 更改文件的App Name,然后运行到不同的文件夹:
VAGRANTFILE_API_VERSION = "2"
APP_NAME = "app1"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = 'azure'
config.vm.provision "fix-no-tty", type: "shell" do |s|
s.privileged = false
s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile"
end
config.vm.provider :azure do |azure|
azure.mgmt_certificate = "CERT"
azure.mgmt_endpoint = 'https://management.core.windows.net'
azure.subscription_id = 'ID'
azure.storage_acct_name = 'dev1' # optional. A new one will be generated if not provided.
azure.vm_image = 'b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04-LTS-amd64-server-20140528-en-us-30GB'
azure.vm_user = 'USER' # defaults to 'vagrant' if not provided
azure.vm_password = 'PASSWORD' # min 8 characters. should contain a lower case letter, an uppercase letter, a number and a special character
azure.vm_name = "#{APP_NAME}-DEV"
azure.cloud_service_name = "DEV-CLOUD" # same as vm_name. leave blank to auto-generate
azure.deployment_name = "DevDeployment" # defaults to cloud_service_name
azure.vm_location = 'East US' # e.g., West US, Este de EE. UU.
end
config.ssh.username = 'USER' # modify this username
config.ssh.password = 'PASSWORD' # If windows or user/pass auth enabled
end
在这种情况下,第二个框运行结束 [31m [1mConflictError:指定的部署位置生产被占用。[0m [0m
答案 0 :(得分:0)
此功能未在插件版本< = 1.2.1中实现。已经在Github上提交了issue以及pull request。
$ vagrant plugin install vagrant-azure
Installing the 'vagrant-azure' plugin. This can take a few minutes...
Installed the plugin 'vagrant-azure (1.2.1)'!