I’m a bit confused about one aspect of using Digital Ocean as a provider for Vagrant. How is it possible that multiple developers can access the same Vagrant Box if it is on Digital Ocean? Would they all need the same ssh key and API tokens?
Thank you.
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!
When specifying the DigitalOcean user account that will create the droplet, you can only set one user and API token. Though you can still take advantage of all the different powerful provisioners that Vagrant can employ to configure the droplet. You can create new user accounts, add ssh keys, etc…
Here’s an extremely simple example that runs the command ssh-import-id on the newly created droplet to import the public ssh keys associated with the GitHub user andrewsomething It’s one quick way to get another developer’s key on the machine:
Vagrant.configure('2') do |config|
config.vm.provider :digital_ocean do |provider, override|
override.ssh.private_key_path = '~/.ssh/id_rsa'
override.vm.box = 'digital_ocean'
override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
provider.token = 'MY_API_TOKEN'
provider.image = '14.04 x64'
provider.region = 'nyc3'
provider.size = '512mb'
provider.ssh_key_name = 'ssh_key_name'
end
config.vm.provision "shell",
inline: "ssh-import-id gh:andrewsomething"
end
This uses the “shell” provisioner, but you can also use more sophisticated configuration management tools like Puppet, Chef, and Ansible.
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.