Introducing Salt Cloud on Scaleway

SaltStack is an infrastructure management solution that aims to help you scale your infrastrucure in an extremly easy, fast and scalable way. SaltStack was created for predictive orchestration, cloud automation, server provisioning, application deployment and more.

We worked with the SaltStack team to provide a new native driver for Salt Cloud and it's now available in the main tree.
salt is an amazing tool and the combination with Salt Cloud on Scaleway will let you provision your servers faster!

Salt cloud

This blog post shows you how easy it is to create BareMetal servers using Salt Cloud. We will also configure the servers with salt.

Demo

Let's check what you can do with SaltStack on Scaleway and how simple it is to deploy a new scalable infrastructure.
We will create a salt master node and 5 salt minion nodes. Minion can be considered as slave nodes.

1. Install Salt Cloud on your machine

The first thing before deploying the master and minion nodes is to install Salt Cloud on your machine.

apt-get update  
apt-get install python-pip python-m2crypto python-dev build-essential libzmq-dev

pip install salt

mkdir -p /etc/salt/cloud.profiles.d/  
mkdir -p /etc/salt/cloud.providers.d/  
2. Configure Salt Cloud with Scaleway provider

Next, configure the Scaleway provider that will be used by Salt Cloud.

Create a new configuration file /etc/salt/cloud.providers.d/scaleway.conf with the following information:

scaleway-config:  
  access_key: <your_access_key>
  token: <your_token>
  driver: scaleway
  display_ssh_output: False
  sync_after_install: all
  key_filename: <path/to/your/ssh_private.key>

Replace <your_access_key> and <your_token> by your credentials.

Your ssh public key must be present on the SSH Keys section of the control panel to connect the server that will be provisionned by Salt Cloud

To check that provider works fine, execute salt-cloud -F scaleway, it will print out all available information about your Scaleway servers.

# salt-cloud -F scaleway
[INFO    ] salt-cloud starting
[INFO    ] Starting new HTTPS connection (1): api.scaleway.com
scaleway-config:  
    ----------
    scaleway:
        ----------
        salt-manager:
            ----------
            creation_date:
                2015-06-03T08:17:38.818068+00:00
            hostname:
                salt-manager
...

At this point, you have a server running with Salt Cloud installed on it, the Scaleway provider is configured.

Now, we neeed to provision the master and the minion nodes.

3. Setup cloud profiles

The first thing to do is to create a profile for the master and minion nodes. Profiles let you define template for the nodes you will deploy with Salt Cloud.

Create a new file /etc/salt/cloud.profiles.d/ubuntu.conf with the following configuration:

saltmaster-ubuntu:  
  provider: scaleway-config
  image: Ubuntu Vivid (15.04 latest)
  make_master: True

saltminion-ubuntu:  
  provider: scaleway-config
  image: Ubuntu Vivid (15.04 latest)
4. Provision the Salt master and minion servers

We are now ready to perform the deployment of the master and the 5 minion nodes. There are various way to deploy servers. You can directly deploy nodes from the command line or you can use map file for more complex scenario. Map files allow you to deploy a serie of servers associated with specific profile.

The following map file will create a master node from the saltmaster-ubuntu profile and 5 minion nodes from the saltminion-ubuntu profile:

saltmaster-ubuntu:  
  - master
saltminion-ubuntu:  
  - slave01
  - slave02
  - slave03
  - slave04
  - slave05

To execute the mapfile, run:

salt-cloud -P -m /path/to/mapfile --script-args="-P"  

The --script argument lets you provide arguments to the bootstrap script when deploying the server. The -P argument is to enable pip based installation.

Et voilà, your master and minion nodes are now up on Scaleway!

You can now validate everything is working fine by running a test.ping on your master node. It will return the status of all your minion.

root@master:~# salt '*' test.ping  
slave05:  
    True
slave03:  
    True
slave02:  
    True
slave04:  
    True
slave01:  
    True
master:  
    True

If you have any questions, joins us on the community platform or open a support ticket, we're always happy to help.

Happy Cloud Riding,

Author image

Edouard Bonlieu

Strategy and marketing at Online.net & Scaleway