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!
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.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.