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 the following: You already have a salt-master. You already have a Digital Ocean account.
Step one, install the most recent version of salt-cloud (salt-cloud==0.8.9) on the salt-master:
easy_install salt-cloud==0.8.9 # or if you prefer ... pip install salt-cloud==0.8.9 # 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 uncommented statements:
provider: do minion: master: master.foxhop.net append_domain: foxhop.net
This is the provider configuration file. We will create the do (Digital Ocean) provider in this file. Collect your client_key and api_key from the user dashboard. Also create an SSH key and add the public key using the dashboard:
# For Digital Ocean do: provider: digital_ocean client_key: MyClientKeyLiftedFromDashboard api_key: MyAPIKeyLiftedFromDashboard ssh_key_file: /keys/digital-ocean-salt-cloud ssh_key_name: digital-ocean-salt-cloud.pub
This is the profiles configuration file. We will create just one profile for now, but you can create unlimited named combinations.
ubuntu_do: provider: do image: Ubuntu 12.04 x64 size: 512MB script: Ubuntu location: New York 1
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, 512M is the smallest plan
The geographical location or datacenter
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_do 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!