Report this

What is the reason for this report?

Concerning Vagrant with Digital Ocean as a Provider and multiple users...

Posted on November 5, 2014

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!

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.

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.