Only run code if provider is not virtualbox

13 views
Skip to first unread message

NieLeben

unread,
Jun 7, 2019, 3:19:45 PM6/7/19
to Vagrant
This is my current Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "mrlesmithjr/windows10"
  config.ssh.forward_agent = true
  config.vm.provider "virtualbox" do |v, _override|
    v.linked_clone = true
    config.vm.synced_folder '..\\..\\data', '/vagrant_data'
  end
  unless config.vm.provider = "virtualbox"
    config.vm.synced_folder '..\\..\\data', '/vagrant_data', type: 'smb', mount_options: ['mfsymlinks']
  end
  config.vm.network 'private_network', ip: '192.168.33.10'
end

But it always throws an error at:
  unless config.vm.provider = "virtualbox"

After about an hour of googling i don't know what to do.

Benjamin Lu

unread,
Jun 7, 2019, 5:36:15 PM6/7/19
to Vagrant
It should be

Vagrant.configure("2") do |config|
  config.vm.box = "mrlesmithjr/windows10"
  config.ssh.forward_agent = true
  config.vm.provider :virtualbox do |v, _override|
    v.linked_clone = true
    config.vm.synced_folder '..\\..\\data', '/vagrant_data'
  end
  config.vm.network 'private_network', ip: '192.168.33.10'
end
Reply all
Reply to author
Forward
0 new messages