Salt-cloud Ubuntu Installation (especially for DigitalOcean)
Article is a brief step-by-step manual to init salt-cloud.
Ubuntu 14.04, Salt-cloud 2014.1.10 (Hydrogen).
Salt-cloud
Create folder for salt-cloud keys:
sudo mkdir -p /srv/salt/keys
Generate key with empty passphrase, set key file as /srv/salt/keys/digitalocean-salt-cloud
:
sudo ssh-keygen -t rsa
Copy and paste key to your DigitalOcean SSH Keys with name digitalocean-salt-cloud.pub
:
cat /srv/salt/keys/digitalocean-salt-cloud.pub
Install salt-cloud with dependencies:
sudo add-apt-repository ppa:saltstack/salt sudo apt-get update sudo apt-get install -y python-m2crypto python-msgpack python-libcloud python-zmq salt-cloud
Check: salt-cloud --version
Mine, no errors: salt-cloud 2014.1.10 (Hydrogen)
Warning
I’ve noticed salt-cloud creates minion with master: salt
in it’s config instead of master: yoursaltcloudhostservername
. You have to change it or point salt
host to the proper IP.
DigitalOcean
Copy your Client ID
and API Key
from DigitalOcean Aps & API page.
Edit provider’s config:
sudo vi /etc/salt/cloud.providers.d/digitalocean.conf
Example:
do: client_key: <Client ID> api_key: <Api Key> provider: digital_ocean ssh_key_name: digitalocean-salt-cloud.pub ssh_key_file: /srv/salt/keys/digitalocean-salt-cloud
Edit profile’s config:
sudo vi /etc/salt/cloud.profiles.d/digitalocean.conf
Example:
ubuntu-14-04-x64-512-ams2: provider: do image: Ubuntu 14.04 x64 size: 512MB location: Amsterdam 2 private_networking: True
From now you can create DigitalOcean droplets:
sudo salt-cloud -p ubuntu-14-04-x64-512-ams2 hostnameyouwant
Salt-cloud Sources
Useful but doesn’t work for me as is. Try it for deeper digging:
- https://docs.saltstack.com/en/latest/topics/cloud/install/index.html
- https://www.digitalocean.com/community/tutorials/automated-provisioning-of-digitalocean-cloud-servers-with-salt-cloud-on-ubuntu-12-04
Salt Master
You will need salt-minion if you are going to manage your salt-cloud host server by salt-master located on the same machine:
sudo apt-get install -y salt-master salt-minion
Point salt-minion to the localhost: add master: localhost
to the config sudo vi /etc/salt/minion.d/local.conf
, restart salt-minion sudo service salt-minion restart
and accept minion key sudo salt-key -a minionkeyname
. Minion key name you can get from sudo salt-key -L
.