title: Multi-machine Vagrant project not provisioning as per docs
body: <p>I’ve trying to set up a multi-machine Vagrant project. According to the docs (<a href="https://www.vagrantup.com/docs/multi-machine/" rel="nofollow">https://www.vagrantup.com/docs/multi-machine/</a>), provisioning is “outside in”, meaning any top-level provisioning scripts are executed before provisioning scripts in individual machine blocks.</p>
  
  <p>The project contains a Laravel project, and a Symfony project. My <code>Vagrantfile</code> looks like this:</p>
  
  <pre class="lang-ruby prettyprint-override"><code>require "json"
  require "yaml"
  
  confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
  
  homesteadYamlPath = "web/Homestead.yaml"
  homesteadJsonPath = "web/Homestead.json"
  afterScriptPath = "web/after.sh"
  aliasesPath = "web/aliases"
  
  require File.expand_path(confDir + "/scripts/homestead.rb")
  
  Vagrant.configure(2) do |config|
    config.vm.provision "shell", path: "init.sh"
  
    config.vm.define "web" do |web|
      web.ssh.forward_x11 = true
  
      if File.exists? aliasesPath then
        web.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
      end
  
      if File.exists? homesteadYamlPath then
        Homestead.configure(web, YAML::load(File.read(homesteadYamlPath)))
      elsif File.exists? homesteadJsonPath then
        Homestead.configure(web, JSON.parse(File.read(homesteadJsonPath)))
      end
  
      if File.exists? afterScriptPath then
        web.vm.provision "shell", path: afterScriptPath
      end
    end
  
    config.vm.define "api" do |api|
      api.vm.box = "ubuntu/trusty64"
  
      api.vm.provider :virtualbox do |vb|
        vb.customize ["modifyvm", :id, "--memory", "2048"]
      end
  
      api.vm.network "private_network", ip: "10.1.1.34"
      api.vm.network "forwarded_port", guest: 80, host: 8001
      api.vm.network "forwarded_port", guest: 3306, host: 33061
      api.vm.network "forwarded_port", guest: 9200, host: 9201
  
      api.vm.synced_folder "api", "/var/www/api"
  
      api.vm.provision "shell", path: "api/provision.sh"
    end
  end
  </code></pre>
  
  <p>I have a block (<code>web</code>) for the Laravel project, where I’ve copied the contents of the Homestead-based <code>Vagrantfile</code>, and an <code>api</code> block that uses the “standard” Vagrant configuration.</p>
  
  <p>To bootstrap the projects, I created a simple shell script (<strong>init.sh</strong>) that simply clones the Git repositories into git-ignored directories. Given the documentation says configuration works outside-in, I’d therefore expect that script to run, and then the machine-specific blocks, but this doesn’t seem to be happening. Instead, on <code>vagrant up</code>, I receive the following error:</p>
  
  <blockquote>
    <p>There are errors in the configuration of this machine. Please fix the following errors and try again:</p>
    
    <p>vm:<br>
    * A box must be specified.</p>
  </blockquote>
  
  <p>It seems it’s still trying to provision the individual machines, before running the shell script. I know the shell script isn’t getting called as I added an <code>echo</code> statement to it. Instead, the terminal just outputs the following:</p>
  
  <blockquote>
    <p>Bringing machine 'web' up with 'virtualbox' provider...<br>
    Bringing machine 'api' up with 'virtualbox' provider...</p>
  </blockquote>
  
  <p>So how can I get Vagrant to run my shell script first? I think it’s failing because the <code>web</code> group is checking if my <strong>web/Homestead.yaml</strong> file exists and if so, use the values in there for configuring (including the box name), but as my shell script hasn’t been ran and hasn’t cloned the repository that file does not exist, so there is no <code>box</code> specified, which Vagrant complains about.</p>