How to Install saltstack minion on a Raspberry PI

saltstack is an awesome configuration management tool to ensure that you have complete control over the configuration of all of the computers in your environment. It is an enterprise-class tool, run by very large companies with very many computers. Big companies like eBay, LEGO, and Liberty Mutual! I have a bunch of raspberry pi computers, running various tasks, that need some level of consistency or, at least, a quick way to set up new hosts in my house. I’ve got a bank of PI 3’s running this website. I’ve got one running my monitoring software, Munin. I’ve got a pi-hole, a transmission server, and a couple of pis hidden behind the TVs in the house, running KODI.

So, I need a way to do all the tedious tasks of adding a new raspberry to the network: removing unused software, setting the passwords, turning off IPv6, installing the monitoring client, etc. To that end, I install salt-minion on each new raspberry pi that I turn on in the house.

First, you’ll new a salt-master. Installation of that can be found here. Once you have the salt-master in place, you can start adding salt-minions. The steps are simple. Here’s the commands for cutting and pasting. What follows includes the responses from the host.

wget -O - http://repo.saltstack.com/py3/debian/10/armhf/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -

echo 'deb http://repo.saltstack.com/py3/debian/10/armhf/latest buster main' > /etc/apt/sources.list.d/saltstack.list

apt-get update

apt-get install salt-minion

The first task is to setup the saltstack repo. Add the gpg key and then add the repo source.

root@zero:~# wget -O - http://repo.saltstack.com/py3/debian/10/armhf/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
--2020-04-13 14:12:07-- http://repo.saltstack.com/py3/debian/10/armhf/latest/S ALTSTACK-GPG-KEY.pub
Resolving repo.saltstack.com (repo.saltstack.com)… 13.225.205.88, 13.225.205.6 2, 13.225.205.109, …
Connecting to repo.saltstack.com (repo.saltstack.com)|13.225.205.88|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 1727 (1.7K) [application/octet-stream]
Saving to: ‘STDOUT’
100%[===================>] 1.69K --.-KB/s in 0s
2020-04-13 14:12:08 (14.1 MB/s) - written to stdout [1727/1727]
OK
root@zero-syl:~# echo 'deb http://repo.saltstack.com/py3/debian/10/armhf/latest buster main' > /etc/apt/sources.list.d/saltstack.list

Now, update apt with the new source:

root@zero-syl:~# apt-get update
Get:1 http://repo.saltstack.com/py3/debian/10/armhf/latest buster InRelease [2,129 B]
Get:2 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
Get:3 http://archive.raspbian.org/raspbian stretch InRelease [15.0 kB]
Get:4 http://archive.raspberrypi.org/debian buster InRelease [25.1 kB]
Get:5 http://repo.saltstack.com/py3/debian/10/armhf/latest buster/main armhf Packages [2,306 B]
Get:6 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages [13.0 MB]
Get:7 http://archive.raspbian.org/raspbian stretch/main armhf Packages [11.7 MB]
Get:8 http://archive.raspberrypi.org/debian buster/main armhf Packages [326 kB]
Fetched 25.1 MB in 1min 31s (275 kB/s)
Reading package lists… Done

Now that your installation is aware of the new saltstack repo, you can begin the installation:

root@zero-syl:~# apt-get install salt-minion
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
python-apt python-backports-abc python-concurrent.futures python-croniter python-dateutil python-msgpack
python-singledispatch python-systemd python-tz python-zmq
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
python3-croniter python3-distro python3-msgpack python3-systemd python3-tz python3-yaml salt-common
Suggested packages:
python3-pycurl python3-twisted python3-augeas
The following NEW packages will be installed:
python3-croniter python3-distro python3-msgpack python3-systemd python3-tz python3-yaml salt-common salt-minion
0 upgraded, 8 newly installed, 0 to remove and 40 not upgraded.
Need to get 7,184 kB of archives.
After this operation, 32.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://repo.saltstack.com/py3/debian/10/armhf/latest buster/main armhf salt-common all 3000.1+ds-1 [6,860 kB]
Get:2 http://mirror.umd.edu/raspbian/raspbian buster/main armhf python3-tz all 2019.1-1 [27.1 kB]
Get:3 http://mirror.umd.edu/raspbian/raspbian buster/main armhf python3-croniter all 0.3.24-2 [17.3 kB]
Get:4 http://mirror.umd.edu/raspbian/raspbian buster/main armhf python3-distro all 1.3.0-1 [14.3 kB]
Get:5 http://mirror.umd.edu/raspbian/raspbian buster/main armhf python3-msgpack armhf 0.5.6-1+b1 [91.2 kB]
Get:6 http://mirror.umd.edu/raspbian/raspbian buster/main armhf python3-systemd armhf 234-2+b1 [34.1 kB]
Get:7 http://mirror.umd.edu/raspbian/raspbian buster/main armhf python3-yaml armhf 3.13-2 [111 kB]
Get:8 http://repo.saltstack.com/py3/debian/10/armhf/latest buster/main armhf salt-minion all 3000.1+ds-1 [28.3 kB]
Fetched 7,184 kB in 4s (1,941 kB/s)
Selecting previously unselected package python3-tz.
(Reading database … 140730 files and directories currently installed.)
Preparing to unpack …/0-python3-tz_2019.1-1_all.deb …
Unpacking python3-tz (2019.1-1) …
Selecting previously unselected package python3-croniter.
Preparing to unpack …/1-python3-croniter_0.3.24-2_all.deb …
Unpacking python3-croniter (0.3.24-2) …
Selecting previously unselected package python3-distro.
Preparing to unpack …/2-python3-distro_1.3.0-1_all.deb …
Unpacking python3-distro (1.3.0-1) …
Selecting previously unselected package python3-msgpack.
Preparing to unpack …/3-python3-msgpack_0.5.6-1+b1_armhf.deb …
Unpacking python3-msgpack (0.5.6-1+b1) …
Selecting previously unselected package python3-systemd.
Preparing to unpack …/4-python3-systemd_234-2+b1_armhf.deb …
Unpacking python3-systemd (234-2+b1) …
Selecting previously unselected package python3-yaml.
Preparing to unpack …/5-python3-yaml_3.13-2_armhf.deb …
Unpacking python3-yaml (3.13-2) …
Selecting previously unselected package salt-common.
Preparing to unpack …/6-salt-common_3000.1+ds-1_all.deb …
Unpacking salt-common (3000.1+ds-1) …
Selecting previously unselected package salt-minion.
Preparing to unpack …/7-salt-minion_3000.1+ds-1_all.deb …
Unpacking salt-minion (3000.1+ds-1) …
Setting up python3-distro (1.3.0-1) …
Setting up python3-yaml (3.13-2) …
Setting up python3-tz (2019.1-1) …
Setting up python3-msgpack (0.5.6-1+b1) …
Setting up python3-systemd (234-2+b1) …
Setting up python3-croniter (0.3.24-2) …
Setting up salt-common (3000.1+ds-1) …
Setting up salt-minion (3000.1+ds-1) …
Processing triggers for man-db (2.8.5-2) …
Processing triggers for systemd (241-7~deb10u3+rpi1) …
root@zero-syl:~# systemctl enable --now salt-minion
Synchronizing state of salt-minion.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable salt-minion

Now, double-check the minion_id. The minion_id is the name that salt uses to address this host. It does not need to match the hostname. In my case, I like to make sure that it does. Edit the minion_id file for correctness.

root@zero-syl:~# vi /etc/salt/minion_id

Done! Reboot and look for the new minion reporting in on your salt-master.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.