Step by step guide to safely upgrading your SaltStack master and minions

We’ve noticed a bit of confusion and understandable trepidation around upgrading SaltStack with some of our customers. Salt is pretty darn important to your stack, so keeping it working is essential. To help, we’ve written up this HOWTO guide for easily and safely upgrading your master and minions.

We mostly work with Ubuntu and Debian based systems, so while the steps to upgrade are the same on other Linux systems the exact commands will differ.

This guide also assumes you’ve got the Salt Stack PPA configured in your apt sources.

Step 1 - Update your apt repositories

First you need to make sure your apt repositories are up to date, so you get the latest stable versions. Easiest way to do this is via salt itself:

sudo salt ‘*’ cmd.run “aptitude update”

Step 2 - Upgrade your master

Upgrading the master first ensures you don’t run into any version compatibility issues between your master and minions. So ssh into your master and run:

sudo apt-get upgrade salt-master

Step 3 - Upgrade your minions

Before we attempt to upgrade, let’s take a quick look at the existing versions we have running. This might surprise you, I definitely found a couple of cloud instances that were running older version of salt-minion that I somehow had not upgraded in the past. So get a list of what version of salt your minions are running issue this salt command:

sudo salt ‘*’ test.version

And you’ll get a nice display of every version currently in use. Another useful option here is the command 'manage.versions' which shows you a list of up to date minions vs those that need updating. Here is how you run it:

salt-run manage.versions

Now that we know our base line of versions, let’s upgrade them all:

sudo salt '*' pkg.install salt-minion refresh=True

This is the correct way to do it with Salt, but if you run into any trouble you can always issue the usual Ubuntu commands directly like this:

sudo salt ‘*’ cmd.run “apt-get -y install salt-minion”

Step 4 - Verify everything worked

Everything should be upgraded now and running the latest version of salt-minion. You can verify this by running the test.version command again:

sudo salt ‘*’ test.version

If you see some minions aren’t using the latest version you may need to manually intervene to see what is stopping apt from upgrading things for you.

Hope this help make keeping your SaltStack ecosystem in sync and upgraded to the latest stable versions!