Vagrant Plugin Auto-Installer.

This script automatically installs required Vagrant plugins when you run vagrant up. It’s a simple solution to a common problem when working with teams and Vagrant.

Features

  • Automatically detects missing plugins
  • Installs required plugins seamlessly
  • Compatible with all Vagrant versions
  • Simple to add to any Vagrantfile

Usage

Simply add this code to your Vagrantfile:

required_plugins = ['vagrant-hostsupdater', 'vagrant-vbguest']

plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin }
if not 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

When you run vagrant up, it will automatically check for and install any missing plugins from the required_plugins list.