Vagrantfile:语法错误,意外的输入结束,期待 keyword_end

Vagrantfile: syntax error, unexpected end-of-input, expecting keyword_end

我正在使用 Vargrantfile 在 vi​​rtualbox 上设置一个新的 Ansible 控制器和节点。我继续收到错误消息:

There is a syntax error in the following Vagrantfile. The syntax error message is reproduced below for convenience:

/home/vagrant/ansible/Vagrantfile:19: syntax error, unexpected end-of-input, > expecting keyword_end

我一遍又一遍地更改“end”关键字的位置,但在不同的行上仍然出现相同的错误。我敢肯定这很简单,我只是想念它,这是那些星期之一...

Vagrant.configure("2") do |config|
        config.vm.define "controller" do |controller|
                controller.vm.box = "bento/ubuntu 16.04"
                controller.vm.hostname = "controller"
                controller.vm.network :private_network, ip: "10.10.10.10"
                controller.vm.provider "virtualbox" do |vb|
                        vb.memory = "256"
                end
        end

    (1..3).each do |i|
        config.vm.define "node#{i}" do |node|
                node.vm.box = "bento/ubuntu-16.04"
                node.vm.hostname = "node#{i}"
                node.vm.network :private_network, ip: "10.10.10.1#{i}"
                node.vm.provider "virtualbox" do |vb|
                            vb.memory = "256"
                end
        end

我应该能够在终端中 运行 vagrant up 并在 virtualbox 中获得配置 controllers/nodes 的输出。我错过了什么?

文件末尾缺少 2 "end"s

Vagrant.configure("2") do |config|
  config.vm.define "controller" do |controller|
    controller.vm.box = "bento/ubuntu 16.04"
    controller.vm.hostname = "controller"
    controller.vm.network :private_network, ip: "10.10.10.10"
    controller.vm.provider "virtualbox" do |vb|
      vb.memory = "256"
    end
  end

  (1..3).each do |i|
    config.vm.define "node#{i}" do |node|
      node.vm.box = "bento/ubuntu-16.04"
      node.vm.hostname = "node#{i}"
      node.vm.network :private_network, ip: "10.10.10.1#{i}"
      node.vm.provider "virtualbox" do |vb|
        vb.memory = "256"
      end
    end
  end
end