2

I would like to minimize the setup for users of my vagrant project.

I already think that installing Virtualbox and Vagrant are too steps too many for users of my project. See here for more info on that.

Because my project depends on a few plugins, rather than require the user to use vagrant plugin install ..., I would like to automate installation of the plugins.

Question 1: Is it an ok practise to include the plugin source in my project tree, and include the plugin using Vagrant.require_plugin "plugin-dir/plugin-name"?

Question 2: Will this approach work?

The plugins I depend on are available on github so I can add them as git submodules as described here


Edit

The approach above did NOT work for the vagrant-vbguest plugin

Community
  • 1
  • 1
Chris Snow
  • 23,813
  • 35
  • 144
  • 309
  • Similar question in the Vagrant ML: https://groups.google.com/forum/#!topic/vagrant-up/szfadztOWIw – Emyl Jan 15 '14 at 10:32

1 Answers1

2

I had a similar need and the method I went with was to add the following at the top of my Vagrantfile:

unless Vagrant.has_plugin?("vagrant-omnibus") || ARGV[0] == 'plugin'
  origargs = ARGV.join(" ");
  puts "Plugins not found"
  exec "vagrant plugin install vagrant-omnibus;vagrant #{origargs}"
end

It doesn't really answer your questions I guess but it works for me, I found that I also needed to add sudo in front of the vagrant plugin command for my ubuntu setup, but as you don't state what OS you are running that might not be relevant.

Matt Cooper
  • 9,962
  • 2
  • 31
  • 26
  • I didn't mention it in the question, but I was looking for something that would support cross platform hosts. – Chris Snow Jan 19 '14 at 12:06