-1

My Vagrantfile:

Vagrant.configure("2") do |config|

    config.vm.define "vm1" do |vm1|
      vm1.vm.box = "debian/buster64"
      vm1.vm.box.hostname = "debian-vm"
      vm1.vm.network "private_network", ip: "192.168.15.140"
    end

    vb1.vm.provider "virtualbox" do |vb1|
      vb1.customize ["modifyvm", :id, "--gui", false]         #changed
      vb1.customize ["modifyvm", :id, "--memory", "4092"]     #changed
      vb1.customize ["modifyvm", :id, "--cpus", "4"]          #changed
      vb1.customize ["modifyvm", :id, "--name", "debian-vm"]  #changed
    end

    vm1.vm.provision "shell" do |sh1|
      sh1.inline = "sudo apt-get update"
      sh1.inline = "sudo apt-get install wget ntpdate net-tools nano"
    end

    config.vm.define "vm2" do |vm2|
      vm2.vm.box = "centos7"
      vm2.vm.box.hostname = "centos7-vm"
      vm2.vm.network "private_network", ip: "192.168.15.142"
    end

    vb2.vm.provider "virtualbox" do |vb2|
      vb2.customize ["modifyvm", :id, "--gui", false]        #changed
      vb2.customize ["modifyvm", :id, "--memory", "4092"]    #changed
      vb2.customize ["modifyvm", :id, "--cpus", "4"]         #changed
      vb2.customize ["modifyvm", :id, "--name", "debian-vm"] #changed
    end

    vm2.vm.provision "shell" do |sh2|
      sh2.inline = "sudo yum check-update"
      sh2.inline = "sudo yum -y install wget ntpdate net-tools nano"
      sh2.inline = "curl -fsSL https://get.docker.com/ | sh"
      sh2.inline = "sudo systemctl start docker"
      sh2.inline = "sudo systemctl status docker"
      sh2.inline = "sudo systemctl enable docker"
      sh2.inline = "sudo ps -ef | grep dockerd"
    end

end

The ouput from cmder (terminal) from this Vagranfile is:

C:\Users\Marlon\OneDrive\pipeline (master -> origin)
λ vagrant up
Vagrant failed to initialize at a very early stage:

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

C:/Users/Marlon/OneDrive/pipeline/Vagrantfile:15: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
C:/Users/Marlon/OneDrive/pipeline/Vagrantfile:34: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
1
  • 1
    You have a syntax error on line 15 and line 34. Resolve those then come back to us.
    – Burgi
    Commented Sep 25, 2019 at 8:38

2 Answers 2

1

syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('

This is a follow on error because you have a mistake on the previous line.

vb.cpus = 4

The argument 4 should be quoted, as follows:

vb.cpus = "4"
5
  • Did not solve with quotes. I fixed this section too and it's getting same error :( `config.vm.define "vm1" do |vm2| vm1.vm.box = "centos7" vm1.vm.box.hostname = "centos7-vm" vm1.vm.network "private_network", ip: "192.168.15.142" end' @DavidPostill
    – Marlon
    Commented Sep 25, 2019 at 18:00
  • @Marlon Try the solution here (which does it with a different syntax) virtualbox - Why do the memory and cpu settings on Vagrant fail? - Stack Overflow
    – DavidPostill
    Commented Sep 25, 2019 at 20:43
  • Still getting error even callling this way: vb2.vm.provider "virtualbox" do |vb2| vb2.customize ["modifyvm", :id, "--gui", false] vb2.customize ["modifyvm", :id, "--memory", "4092"] vb2.customize ["modifyvm", :id, "--cpus", "4"] vb2.customize ["modifyvm", :id, "--name", "debian-vm"] end @DavidPostill
    – Marlon
    Commented Sep 25, 2019 at 22:13
  • I don't know people marked with no efforts for this questions because I tried to comment and isolate pieces of the code, tried modified versions, did in a different style and fixed minor bug here.
    – Marlon
    Commented Sep 26, 2019 at 1:52
  • Did you see my reply? I can't vote for own post, if you could do that. The problem was about syncing the files of vagrant folders.
    – Marlon
    Commented Sep 26, 2019 at 22:01
0

I was figuring out and discover that the place where I stored was not syncing (OneDrive), then I put in a static folder and get successfull!

Did some fix and and some commands and put the final works here.

PS: Just discovered because Onedrive was claiming with a warning, and I have a lot of huge files inside some folders.

Vagrant.configure("2") do |config|
  config.vm.provider "virtualbox" do |vb|
     vb.gui = false
     vb.memory = "4096"
     vb.cpus = "4"
  end

  config.vm.define "vm1" do |vm1|
      vm1.vm.box = "centos/7"
      vm1.vm.network "public_network", bridge: "en1: Realtek PCIe GBE Family Controller"
      vm1.vm.network "public_network", ip: "192.168.15.140"
      vm1.vm.hostname = "centos-vm"

      vm1.vm.provision "shell", inline: <<-SHELL
         sudo yum update
         sudo yum -y install wget ntpdate net-tools nano
         sudo curl -fsSL https://get.docker.com/ | sh
         sudo systemctl start docker
         sudo systemctl status docker
         sudo systemctl enable docker
         sudo ps -ef | grep dockerd
      SHELL
  end

  config.vm.define "vm2" do |vm2|
      vm2.vm.box = "debian/buster64"
      vm2.vm.network "public_network", bridge: "en1: Realtek PCIe GBE Family Controller"
      vm2.vm.network "public_network", ip: "192.168.15.142"
      vm2.vm.hostname = "debian-vm"

      vm2.vm.provision "shell", inline: <<-SHELL
         sudo apt-get update
         sudo apt-get install wget ntpdate net-tools nano
      SHELL
  end

end

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .