Getting Started With SaltStack On Ubuntu
SaltStack is an opensource project (github link) that makes it much easier to manage your infrastructure at scale. For example, to update all of your servers, you could log into each one and enter the relevant command. This would be extremely tedious and take a long time as soon as you start to manage 10+ servers. With Saltstack, one can achieve this by executing a single command on a single node which we call the salt master. Best of all, it is highly parallelized with nodes acting independently rather than one after each other (serially), so operations take seconds instead of hours.
There are similar projects, such as Puppet and Chef which you can learn about here and here respectively, but I chose Salt because looking through the tutorials, Saltstack appeared to be a lot simpler/quicker to setup. I believe that those other two projects have the market share if you were looking to improve your job prospects.
Installing The Salt Master
Salt is made up of two parts, the minions that are "controlled" and the master that controls them. You only need one master, and it can control any number of minions. Because this server will have control over your other servers, I recommend being very careful with its security and configuring it with two factor authentication.
Installing The Minon
sudo apt-get install salt-minion -y sudo vim /etc/salt/minion
sudo vim /etc/salt/minion and change:
Now restart the service for the changes to take effect.
sudo service salt-minion restart
After your minions have been configured with the masters hostname/IP, you need to accept their keys.
List the keys with the following command:
sudo salt-key -L
Acept a specific key with the following command:
sudo salt-key -a $DOMAIN
If you're lazy like me, then you can accept all the keys with the following command instead:
Update all minions
sudo salt '*' pkg.upgrade
First published: 16th August 2018