Ella C.
Ella C.

Reputation: 3

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

I'm setting up a new Ansible controller and nodes on virtualbox with a Vargrantfile. I continue to get the error:

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

I'm changing the placement of the "end" keyword over and over, but still getting the same error on different lines. I'm sure this is simple and I'm just missing it, it's been one of those weeks...

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

I should be able to run vagrant up in the terminal and get an output of provisioning controllers/nodes in virtualbox. What am I missing?

Upvotes: 0

Views: 7665

Answers (1)

jbw
jbw

Reputation: 83

You're missing 2 "end"s at the end of the file

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

Upvotes: 3

Related Questions