1

As a developer, if I want each and every vagrant box I build from any repository to include my customisations, how would I achieve that?

For example, I have my own vim config, my own tmux config, my own git config, plus there are certain command-line tools I expect on every unix environment I use, such as the aforementioned plus curl and ack.

I would hope Vagrant would include the ability to customise local versions of checked-out box configurations, but I couldn't find out how to do it.

I can't use the normal Vagrantfile because this comes from the repository. I can't create a custom base box, because the Vagrantfile that is checkout out from the repository specifies which base box it wants to use.

Currently the best way I've come up with is to create a repository containing my configs and set it up when I first log in to a newly built Vagrant box by installing all the software I expect through apt-get and then importing my configuration files, but clearly this is frustrating if I'm building a lot of boxes.

Does anyone know how I can automate this?

1 Answer 1

4

There are actually a bunch of Vagrantfiles, loaded in a specific order.

The one that's meant for personal/local customisations is located in ~/.vagrant.d/, so any changes you want applied to all boxes build by you, just put them in a ~/.vagrant.d/Vagrantfile.

Voila!

1
  • And you could use this to add custom provisioning logic with chef or puppet, and pass a set of manifests in your home directory, which could be shared across all boxes
    – timmow
    Commented Mar 13, 2013 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.