Syntax Vagrant中的语法错误

Syntax Vagrant中的语法错误,syntax,vagrant,vagrantfile,Syntax,Vagrant,Vagrantfile,我的Vagrant文件中有以下代码,可以使用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

我的Vagrant文件中有以下代码,可以使用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
有人能帮我找出为什么我会犯这个错误吗


谢谢

您的“config.vm.provision”ansible“do | ansible |”do语句似乎缺少“end”关键字。我认为下面的改变应该有效

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