Vagrant

时间:2017-03-12 00:08:17

标签: syntax vagrant vagrantfile

我的Vagrantfile中有这个代码使用Ansible来配置我的虚拟机:

Vagrant.configure("2") do |config|
  config.vm.box = "geerlingguy/centos7"
  config.vm.provision "ansible" do |ansible|
    ansible.playbook = "playbook.yml"
end

但现在我收到了这个错误:

> There is a syntax error in the following Vagrantfile. The syntax error
> message is reproduced below for convenience:
> 
> /Users/vagrant/Vagrantfile:5: syntax error, unexpected
> end-of-input, expecting keyword_end

有人可以帮忙弄清楚我为什么会收到这个错误吗?

谢谢!

1 个答案:

答案 0 :(得分:1)

您似乎错过了“config.vm.provision”ansible“do | ansible |”的“end”关键字做声明。我认为以下改变应该有效。

Vagrant.configure("2") do |config|
  config.vm.box = "geerlingguy/centos7"
  config.vm.provision "ansible" do |ansible|
    ansible.playbook = "playbook.yml"
  end
end