Created
February 19, 2017 02:18
-
-
Save devlucas/190cf90080c9c3d5d8800078add478cd to your computer and use it in GitHub Desktop.
Simple Vagrantfile that checks for required plugins and installs them when they are missing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
required_plugins = %w(vagrant-exec vagrant-vbguest) | |
plugins_to_install = required_plugins.select do |plugin| | |
!Vagrant.has_plugin? plugin | |
end | |
unless plugins_to_install.empty? | |
puts "Installing plugins: #{plugins_to_install.join(' ')}" | |
if system "vagrant plugin install #{plugins_to_install.join(' ')}" | |
exec "vagrant #{ARGV.join(' ')}" | |
else | |
abort 'Installation of one or more plugins has failed. Aborting.' | |
end | |
end | |
Vagrant.configure(2) do |config| | |
config.vm.box = 'ubuntu/trusty64' | |
config.vm.provider 'virtualbox' do |v| | |
v.memory = 1024 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment