sample-infrastructure-repo icon indicating copy to clipboard operation
sample-infrastructure-repo copied to clipboard

[WIP] Try using plain vagrant-berkshelf instead of vagrant-toplevel-cookbooks (alternative approach)

Open tknerr opened this issue 10 years ago • 1 comments

This PR tries to achieve the same as #4, namely replacing the need for vagrant-toplevel-cookbooks by using a plain vagrant-berkshelf solution.

In contrast to #4, the approach here is to use separate Berksfiles per VM rather than a single Berksfile with groups:

  • using config.berkshelf.path = "Berksfile.<name>" to define disjoint Berksfiles
  • defining one Berksfile per VM

It seems to work quite well in the first experiments. Notes:

  • it creates a separate .lock file for each Berksfile -- so there's no potential conflict here as with using the groups feature
  • (!) you need to delete the .lock file when updating the cookbook version via the tag ref. rm Berksfile.app_v1.lock && vagrant provision app_v1 works :+1:

tknerr avatar Jan 25 '15 23:01 tknerr

Still, even if that works, there's some reason for vagrant-toplevel-cookbooks though:

  1. not cluttering your project with so many Berksfiles
  2. no need to remove the .lock files before updating a version
  3. programmability from within the Vagrantfile

Last one could be achieved by having a function or "mini-plugin" in the .vagrant_plugins file as well, but that would have to be created per-project. So having a globally installed vagrant plugin makes sense as well.

tknerr avatar Jan 26 '15 06:01 tknerr