我想在新配置的服务器上的 Vagrant 文件中运行一个单独的配置 block 。目前,当我从我的 CI 服务器运行它时
vagrant up
以下 block 执行成功
config.vm.provider :linode do |provider, override|
#creates a new instance etc .. the following block runs on this instance
end
config.vm.provision :chef_solo do |chef|
chef.provisioning_path = "/tmp/deploy"
chef.cookbooks_path = ["cookbooks"]
chef.add_recipe = "mydeployagent"
end
现在我想在之后运行一个单独的供应商。 (CI 服务器中的一个单独任务)即
config.vm.provision :chef_solo do |chef|
chef.provisioning_path = "/tmp/deploy"
chef.cookbooks_path = ["cookbooks"]
chef.add_recipe = "mydeploydatabaseagent"
end
我想弄清楚我需要什么
运行 vagrant up 以便它只执行第一个配置 block
运行 vagrant,这样它只会在 1 中创建的实例上运行第二个供应 block 。
提前致谢
最佳答案
来自 Vagrant docs .
Vagrant.configure("2") do |config|
# ... other configuration
config.vm.provision "bootstrap", type: "shell" do |s|
s.inline = "echo hello"
end
end
The --provision-with flag can be used if you only want to run a specific provisioner if you have multiple provisioners specified. For example, if you have a shell and Puppet provisioner and only want to run the shell one, you can do vagrant provision --provision-with shell. The arguments to --provision-with can be the provisioner type (such as "shell") or the provisioner name (such as "bootstrap" from above).
关于vagrant - 使用 Vagrant 运行特定的 provision block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29585670/