I’ve been using DigitalOcean in my personal projects and for me it has been a good cost benefit.
This weekend I was learning how to create a droplet using Vagrant with the plugin vagrant-digitalocean and how to use Ansible as provisioner.
So let’s see what I did to get all these things working!
You have to install Vagrant and Ansible on your local machine.
With the Vagrant installed you can install the vagrant-digitalocean plugin
Now you have to add a box with the provider digital_ocean. For this I used the box that is on the DigitalOcean tutorial:
If you don’t have a ssh key, you have to generate one.
The next step is to create the file Vagrantfile
Edit the Vagrantfile to look like this
In this tutorial I’m using a very basic Ansible play-book that installs nodejs, mongodb and nginx.
Create a demo.yml that contains the provision information
Now we’re ready to create our virtual machine at DigitalOcean just running a vagrant up
If everthing is ok, your instance on DigitalOcean is ready.
To wrap up I’ll show you some basic commands
And that’s it, I hope this tutorial could help you somehow.