Hello Dalibor, Are 2 things to take into consideration.
This is the overall simple answer, so apologies in advance if all this is known and doesn't answer your question. One is, Vagrant will load all the Vagrantfiles and follow this rule: https://docs.vagrantup.com/v2/vagrantfile/index.html <QUOTE> Vagrant actually loads a series of Vagrantfiles, merging the settings as it goes. This allows Vagrantfiles of varying level of specificity to override prior settings. Vagrantfiles are loaded in the order shown below. Note that if a Vagrantfile is not found at any step, Vagrant continues with the next step. Vagrantfile packaged with the box that is to be used for a given machine. Vagrantfile in your Vagrant home directory (defaults to ~/.vagrant.d). This lets you specify some defaults for your system user. Vagrantfile from the project directory. This is the Vagrantfile that you'll be modifying most of the time. Multi-machine overrides if any. Provider-specific overrides, if any. At each level, settings set will be merged with previous values. What this exactly means depends on the setting. For most settings, this means that the newer setting overrides the older one. </QUOTE> So by default it should read and merge all the Vagrantfiles. If your base box include other files, you can reference them like this: include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__) load include_vagrantfile if File.exist?(include_vagrantfile) config.ssh.private_key_path = File.expand_path("../vagrant_rsa", __FILE__) This came from this thread as example: http://comments.gmane.org/gmane.comp.tools.vagrant/4813 Alvaro. On Sun, Apr 26, 2015 at 3:48 AM, Dalibor Karlović <[email protected]> wrote: > Hello, > > I have a custom box which contains a embedded Vagrantfile (let's call it > VF1). This file contains a lot of box-specific config / functionality and > the target is I should be (and am) able to generate the project Vagrantfile > (VF2) just with: > > Vagrant.configure(2) do |config| > config.vm.box = "my/box" > end > > and still get all the functionality (Puppet integration, VirtualBox tweaks, > YAML config support, etc). The problem is that I'd like to read files > relative to VF2 from VF1. The way I see it, VF2 gets loaded before VF1 and > thus, Vagrant should be able to figure out where VF2 is before loading > loading VF1. So, how do I access this information? > > Thanks in advance. > > -- > 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. -- 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.
