I found a simple enough solution to this (sorry - never use ruby, except 
for when doing vagrant, so this 
probably seems elementary to some.  but in any case, ill post how i 
externalized my config).

1) If you wrap everything in functions, stuff is more portable

2) You can declare variables w/ capitals (ruby public accessible across 
scripts), and then 
simply create a companion file, config.rb, which you load at the beggining 
of your Vagrantfile, like 

.. Vagrantfile first few lines....

eval File.open('config.rb').read
#Now, if you declared X (note the capital) in config.rb, you can access

#it as a var in your Vagrantfile

puts X



On Friday, August 1, 2014 8:20:17 PM UTC-4, jay vyas wrote:
>
> Hi vagrant.  I've recently externalized my vagrant provisioning function, 
> like this:
>
> Vagrant.configure("2") do |config|  
>       (0..NUMM).each do |i|
>               setup_vm(i, config)
>       end
> end
>
> However, I get errors that "vm * a box must be specified " and "AWS * 
> vagrant_aws.config.ami_required".  
> Thus, it seems that the Vagrant DSL is interpretting the fact that, my
> vm object is not being configured.
>
> the setup_vm function, however, very clearly assigns: 
>
> config.vm.define "aws#{i}" do |n|  
>      n.vm.box = "fedora_aws" 
>
> And so on. 
>
> So My question is : Is it possible to externalize the calls which happen 
> under Vagrant.configure("2") do |config| ? Or does is there some kind of magic
> variable scoping dependency which precludes such externalization.  
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to