Vagrant Cheat Sheet
Reference for Vagrantfile syntax and the vagrant CLI for creating and managing reproducible development VMs.
1 PageBeginnerJan 25, 2026
Basic Vagrantfile
Minimal configuration provisioning a VM with a shell script.
ruby
Vagrant.configure("2") do |config| config.vm.box = "ubuntu/jammy64" config.vm.hostname = "dev-box" config.vm.network "forwarded_port", guest: 80, host: 8080 config.vm.network "private_network", ip: "192.168.56.10" config.vm.provider "virtualbox" do |vb| vb.memory = "2048" vb.cpus = 2 end config.vm.provision "shell", inline: <<-SHELL apt-get update apt-get install -y nginx SHELLend
Vagrant CLI
Common commands for managing the VM lifecycle.
bash
vagrant init ubuntu/jammy64 # Create a Vagrantfilevagrant up # Create and start the VMvagrant ssh # SSH into the VMvagrant halt # Stop the VMvagrant suspend / resume # Pause / resume the VMvagrant destroy # Remove the VM entirelyvagrant reload --provision # Restart and re-run provisionersvagrant status # Show VM state
Key Concepts
Core Vagrant building blocks.
- box- Base VM image/template that Vagrant clones to create new machines
- provider- Backend virtualization engine (virtualbox, vmware, docker, hyperv)
- provisioner- Tool used to configure the VM after boot (shell, ansible, chef, puppet)
- synced folder- Directory shared between host and guest, mounted automatically
- Vagrantfile- Ruby DSL file declaring the machine's configuration
Pro Tip
Use 'config.vm.provision' with the ansible_local provisioner when the host lacks Ansible installed — it installs Ansible inside the guest and runs your existing playbooks unchanged.
Was this cheat sheet helpful?
Explore Topics
#Vagrant#VagrantCheatSheet#DevOps#Beginner#BasicVagrantfile#VagrantCLI#KeyConcepts#Vagrantfile#CommandLine#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech
Professional Web Designing Services
- Responsive Websites
- E-commerce Solutions
- SEO Friendly Design
- Fast & Secure
- Support & Maintenance