Random   •   Archives   •   RSS   •   About   •   Contact

Create your own fleet of servers with Digital Ocean and salt-cloud

Have you heard about Digital Ocean? They offer a polished user interface, KVM guests with SSD storage, and an API to interact with a cloud of hypervisors. API integration got you down? Don't worry, salt-cloud has already integrated Digital Ocean among it's list of providers! The rest of this post illustrates the steps I took to configure salt-cloud to work with Digital Ocean.

This guide assumes you already have a:

Step one, install the most recent version of salt-cloud.

On the salt-master:

sudo apt-get install salt-cloud

# or if you prefer ...
pip install salt-cloud==2015.5.0

# last verify it was successfully installed
salt-cloud --version

Step two, configure salt-cloud.

Salt-cloud uses the following files YAML files for configuration:

This is the main configuration file. I have the following statements:
    master: master.foxhop.net
    append_domain: foxhop.net
This is a provider configuration file for Digital Ocean (do). Collect your client_key and personal_access_token (api_key) from the Digital Ocean user dashboard. Also create an SSH key and add the public key using the dashboard:
# For Digital Ocean
  provider: digital_ocean
  client_key: MyClientKeyLiftedFromDashboard
  personal_access_token: MyAPIKeyLiftedFromDashboard
  ssh_key_file: /keys/digital-ocean-salt-cloud
  ssh_key_name: digital-ocean-salt-cloud.pub
This is the Digital Ocean profiles configuration file. We will create just two profiles for now, but you can create unlimited named combinations.
  provider: do
  image: ubuntu-12-04-x64
  size: 512mb
  location: nyc1

  provider: do
  image: ubuntu-14-04-x64
  size: 512mb
  location: nyc1
This is your private SSH key located on your salt-master
This is the name of the public key you added in your Digital Ocean dashboard
The size or plan you would like to provision, 512mb is the smallest plan
The geographical region, location, and/or data center
The operating system image

After you configure the do provider in /etc/salt/cloud.providers you gain access to the following commands:

salt-cloud --list-sizes do
salt-cloud --list-locations do
salt-cloud --list-images do
salt-cloud --help

Lets provision a new cloud server!

salt-cloud --profile ubuntu-14-04-do-512 deejay

If all goes well you should have a newly provisioned server bootstrapped with salt-minion. The new minion's keys are already added to the salt-master. Now you just need to run highstate!

Want comments on your site?

Remarkbox — is a free SaaS comment service which embeds into your pages to keep the conversation in the same place as your contentr. It works everywhere, even static HTML sites like this one!

Remarks: Create your own fleet of servers with Digital Ocean and salt-cloud

© Russell Ballestrini.