🧩 Day 22 – Exploring Vagrant Plugins & Multi-Stage Vagrantfile Setups

Today’s DevOps learning focused on diving deeper into Vagrant — specifically exploring the powerful world of Vagrant plugins and how to create multi-stage environments using a Vagrantfile.


🔌 Vagrant Plugins – Extend the Power of Vagrant

Vagrant supports a wide range of community and official plugins that enhance its default behavior.

👉 Installing a Plugin:

vagrant plugin install <plugin-name>

🔍 Example Plugins:

  • vagrant-disksize: Resize virtual machine disks

  • vagrant-vbguest: Auto-install VirtualBox Guest Additions

  • vagrant-libvirt: Use libvirt instead of VirtualBox as the provider

🔧 Manage Plugins:

vagrant plugin list
vagrant plugin uninstall <plugin-name>

These plugins open up endless possibilities for customization and optimization of your VMs.


🧱 Multi-Stage Vagrantfile Structure

As setups grow complex, having multiple machines or configurations in a single Vagrantfile is essential.

✅ Example: Two VMs in One Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.define "web" do |web|
    web.vm.box = "ubuntu/bionic64"
    web.vm.hostname = "webserver"
  end

  config.vm.define "db" do |db|
    db.vm.box = "ubuntu/bionic64"
    db.vm.hostname = "dbserver"
  end
end

You can run specific machines:

vagrant up web
vagrant up db

This is perfect for building multi-tier architectures (web + database, for example).


✨ Why This Matters

Combining plugins with multi-stage configurations allows you to:

  • Reuse infrastructure setups

  • Test different tools (e.g., Nginx vs Apache)

  • Simulate production-like setups locally


📌 What’s Next?

Next, I’ll be learning basics of python along with json and yaml


📘 This is part of my DevOps as a Beginner series – where I share my progress daily.
Thanks for reading – feel free to connect, ask questions, or follow along!

#DevOps #Vagrant #VagrantPlugins #Virtualization #HashiCorp #DevOpsBeginner #Linux #InfrastructureAsCode

0
Subscribe to my newsletter

Read articles from Shaharyar Shakir directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shaharyar Shakir
Shaharyar Shakir