Vagrant shell provisioner 重复五次
Vagrant shell provisioner repeats five times
shell provsioner 运行 五次,我找不到为什么会这样。
我的流浪文件:
Vagrant.configure("2") do |config|
config.vm.box = "papasmurf/win2016base"
config.vm.communicator = "winrm"
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"
config.winrm.timeout = 180
config.vm.guest = :windows
config.windows.halt_timeout = 15
config.vm.provider "virtualbox" do |vb|
vb.linked_clone = true
vb.name = "DBSRV2016"
vb.memory = "4096"
vb.gui = false
vb.cpus = 2
config.vm.provision "shell" do |s|
s.privileged = "true"
s.inline = "echo Hello World"
end
end
end
内联命令首先是一个cmd文件,但是我在调查这个问题时发现连echo Hello World都执行了五次。
这是调试日志:https://www.dropbox.com/s/syl8f50xldu32xr/vagrant.log?dl=1
知道这里出了什么问题吗?
将 provision
块移到 provider
外:
Vagrant.configure("2") do |config|
config.vm.box = "papasmurf/win2016base"
config.vm.communicator = "winrm"
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"
config.winrm.timeout = 180
config.vm.guest = :windows
config.windows.halt_timeout = 15
config.vm.provider "virtualbox" do |vb|
vb.linked_clone = true
vb.name = "DBSRV2016"
vb.memory = "4096"
vb.gui = false
vb.cpus = 2
end
config.vm.provision "shell" do |s|
s.privileged = "true"
s.inline = "echo Hello World"
end
end
shell provsioner 运行 五次,我找不到为什么会这样。 我的流浪文件:
Vagrant.configure("2") do |config|
config.vm.box = "papasmurf/win2016base"
config.vm.communicator = "winrm"
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"
config.winrm.timeout = 180
config.vm.guest = :windows
config.windows.halt_timeout = 15
config.vm.provider "virtualbox" do |vb|
vb.linked_clone = true
vb.name = "DBSRV2016"
vb.memory = "4096"
vb.gui = false
vb.cpus = 2
config.vm.provision "shell" do |s|
s.privileged = "true"
s.inline = "echo Hello World"
end
end
end
内联命令首先是一个cmd文件,但是我在调查这个问题时发现连echo Hello World都执行了五次。
这是调试日志:https://www.dropbox.com/s/syl8f50xldu32xr/vagrant.log?dl=1
知道这里出了什么问题吗?
将 provision
块移到 provider
外:
Vagrant.configure("2") do |config|
config.vm.box = "papasmurf/win2016base"
config.vm.communicator = "winrm"
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"
config.winrm.timeout = 180
config.vm.guest = :windows
config.windows.halt_timeout = 15
config.vm.provider "virtualbox" do |vb|
vb.linked_clone = true
vb.name = "DBSRV2016"
vb.memory = "4096"
vb.gui = false
vb.cpus = 2
end
config.vm.provision "shell" do |s|
s.privileged = "true"
s.inline = "echo Hello World"
end
end