By jaitaiwan
I understand that you can use Vagrant to spawn a droplet and do configuration and installation, but what I want to know is if I can use vagrant to spawn multiple droplets without having to have duplicated vagrant projects?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
With Vagrant, each folder and Vagrantfile represents a separate project. If you want to launch multiple copies of the same setup, you’ll need to duplicate the project. If your project needs multiple droplets (e.g. separate web and database servers), you can use a Vagrant multi-machine environment. For instance, this would create two different droplets, one named “db” and one named “web.”
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = 'digital_ocean'
config.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
config.ssh.private_key_path = '/path/to/id_rsa'
config.vm.define "db" do |db|
config.vm.provider :digital_ocean do |provider|
provider.token = 'YOUR_DO_TOKEN'
provider.image = 'ubuntu-14-04-x64'
provider.region = 'nyc3'
provider.size = '512mb'
provider.ssh_key_name = 'key_name'
end
end
config.vm.define "web" do |web|
config.vm.provider :digital_ocean do |provider|
provider.token = 'YOUR_DO_TOKEN'
provider.image = 'ubuntu-14-04-x64'
provider.region = 'nyc3'
provider.size = '512mb'
provider.ssh_key_name = 'key_name'
end
end
end
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
