Generate Robust Vagrant Configurations
A Vagrant configuration expert - multi-machine setups, provider tuning, shell/Ansible provisioning, networking, synced folders, and dev/prod configs.
Why it matters
Automate the creation of complex, multi-machine Vagrant development environments. This asset ensures your virtual infrastructure is provisioned efficiently and adheres to best practices for maintainability and scalability.
Outcomes
What it gets done
Generate Vagrantfiles for multi-machine setups with custom networking.
Implement provider-specific optimizations for VirtualBox, VMware, and Hyper-V.
Integrate shell and Ansible provisioning for automated software installation.
Optimize synced folders and network configurations for performance.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-vagrant-config-generator | bash Overview
Vagrant Config Generator
A Vagrant configuration expert building multi-machine VM setups with provider-specific tuning, shell and Ansible provisioning, networking, synced-folder optimization, and environment-aware config. Use when building or extending a Vagrant multi-machine development environment, tuning VM resources, or automating provisioning with shell scripts or Ansible.
What it does
Builds robust, maintainable Vagrant configurations for VM provisioning and development-environment automation, structured around core principles: pin the "2" API version, define variables and environment-specific config explicitly, keep configurations DRY with reusable blocks, and validate and handle errors properly rather than letting a broken Vagrantfile fail silently. A basic multi-machine pattern defines a hash of machines (web, db, cache) with per-machine IP, memory, and CPU count, then loops over it to create each VM with its own hostname, private-network IP, provider resource allocation, and role-specific shell provisioning and forwarded ports (80/443 for web, 5432 for db). Provider-specific tuning covers VirtualBox (linked clones, DNS resolver and proxy tweaks, IOAPIC, paravirtualization), VMware Desktop (memory, vCPUs, vmxnet3 networking), and Hyper-V (memory, CPUs, virtualization extensions).
Provisioning patterns cover inline shell scripts with set -euo pipefail for real error handling - a worked example installs Docker and Docker Compose, resolving the latest release tag from GitHub's API - external script provisioning with arguments and privilege/color settings, and Ansible integration:
config.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yml"
ansible.inventory_path = "inventory"
ansible.limit = "all"
ansible.extra_vars = {
environment: "development",
debug_mode: true
}
ansible.groups = {
"webservers" => ["web1", "web2"],
"databases" => ["db1"]
}
end
Networking patterns cover multiple private and public network interfaces with internal-network isolation, and forwarded ports with automatic conflict resolution and host-IP binding. Synced folder optimization compares NFS, which performs better on macOS and Linux, SMB for Windows, rsync with exclusion patterns for selective syncing, and disabling the default sync entirely when it is not needed. Environment-specific configuration switches provider resources and sync type based on a VAGRANT_ENV variable, giving development a GUI and NFS sync while production runs headless with sync disabled.
When to use - and when NOT to
Use it when building or extending a Vagrant multi-machine development environment, tuning VM resource allocation, or automating provisioning with shell scripts or Ansible. Performance guidance recommends linked clones to save disk space, CPU and memory allocation sized to actual host resources, provider-specific optimizations like paravirtualization, private networks for inter-VM traffic, and host-only networks when external access is not needed. Debugging configuration covers enabling VirtualBox serial/UART logging and SSH agent/X11 forwarding with keep-alive. Configurations should always be validated with vagrant validate before deployment, kept under version control, with sensitive data kept in environment variables rather than committed to the Vagrantfile.
Inputs and outputs
Takes a development environment's machine topology and resource needs; produces a Vagrantfile with per-machine provider config, provisioning via shell or Ansible, networking, and synced-folder settings, environment-aware for development versus production.
Who it's for
Developers and platform engineers building multi-machine local development environments who want Vagrant configurations that follow infrastructure-as-code practices rather than a single monolithic, unmaintainable Vagrantfile.
Source README
Table of Contents
Docker Compose
Docker Compose is a tool for running multi-container applications on Docker
defined using the Compose file format.
A Compose file is used to define how one or more containers that make up
your application are configured.
Once you have a Compose file, you can create and start your application with a
single command: docker compose up.
Note: About Docker Swarm
Docker Swarm used to rely on the legacy compose file format but did not adopt the compose specification
so is missing some of the recent enhancements in the compose syntax. After
acquisition by Mirantis swarm isn't maintained by Docker Inc, and
as such some Docker Compose features aren't accessible to swarm users.
Where to get Docker Compose
Windows and macOS
Docker Compose is included in
Docker Desktop
for Windows and macOS.
Linux
You can download Docker Compose binaries from the
release page on this repository.
Rename the relevant binary for your OS to docker-compose and copy it to $HOME/.docker/cli-plugins
Or copy it into one of these folders to install it system-wide:
/usr/local/lib/docker/cli-pluginsOR/usr/local/libexec/docker/cli-plugins/usr/lib/docker/cli-pluginsOR/usr/libexec/docker/cli-plugins
(might require making the downloaded file executable with chmod +x)
Quick Start
Using Docker Compose is a three-step process:
- Define your app's environment with a
Dockerfileso it can be
reproduced anywhere. - Define the services that make up your app in
compose.yamlso
they can be run together in an isolated environment. - Lastly, run
docker compose upand Compose will start and run your entire
app.
A Compose file looks like this:
services:
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
redis:
image: redis
Contributing
Want to help develop Docker Compose? Check out our
contributing documentation.
If you find an issue, please report it on the
issue tracker.
Legacy
The Python version of Compose is available under the v1 branch.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.