title: How do I include variables in my VagrantFile?
body: <p>Can anyone guide me to how do I include variables in my VagrantFile? I am trying to inject configs into the Vagrantfile from an external file so that I can distribute the config to my colleagues without having them to hardcode configs directly on the Vagrantfile.</p>
  
  <p>I had thought that since it was Ruby based I could just include a Ruby file but I get an error
  Message: unintialized constant MyVars</p>
  
  <p>My VagrantFile simplified</p>
  
  <pre><code># -*- mode: ruby -*-
  # vi: set ft=ruby :
  require 'vagrant.rb'
  include MyVars
  
  Vagrant.configure("2") do |config|
  
    # Web
    config.vm.define :joe do |joe|
      joe.vm.box = "precise64_4.2.12"
      joe.vm.hostname = WEBVMNAME
      joe.vm.network :private_network, ip: "192.168.140.141"
  
      # Port Forwarding
      joe.vm.network :forwarded_port, guest: 22, host: 2201
      joe.vm.network :forwarded_port, guest: 80, host: 8080
  
      # Bootstrap Bash Script
      joe.vm.provision :shell, :path =&gt; "bootstrap.sh"
    end
  
  end
  </code></pre>
  
  <p>And vagrant.rb contains</p>
  
  <pre><code>module MyVars
  
      WEBVMNAME = "rex"
  
  end
  </code></pre>
  
  <p>Do note that I am also a newbie at Ruby so I am not sure as well if its just the syntax I got wrong?</p>
  
  <p>Edit: Updated code I am using</p>