我在每个vagrant up
的末尾运行几个内联脚本。
Vagrant.configure(2) do |config|
config.vm.box = "bento/ubuntu-16.04"
... omitting all the other steps related to networking, folders, etc
config.vm.provision "shell", inline: "service nginx restart", run: "always"
config.vm.post_up_message = "Done!"
end
我在日志中得到了这个:
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
==> default: Running provisioner: shell...
default: Running: inline script
==> default: mesg:
==> default: ttyname failed
==> default: :
==> default: Inappropriate ioctl for device
==> default: Machine 'default' has a post `vagrant up` message. This is a message
==> default: from the creator of the Vagrantfile, and not from Vagrant itself:
==> default:
==> default: Done!
从目前为止我发现的内容 - 它应该是Ubuntu配置中的东西,而不是Vagrant本身。我发现并尝试了这个解决方案没有成功: https://github.com/mitchellh/vagrant/issues/7368
然而,如果相关 - 我正在运行最新的Vagrant 1.8.7和macOS Sierra。
答案 0 :(得分:0)
似乎它仅适用于Mojave / Catalina的VirtualBox v6.0.2! (+ vagrant 2.2.2-不确定是否重要!)