Once you have the OS installed and (in the case of a Raspberry,) ntp working, you can install stuff. The first thing I want to install is SaltStack. With SaltStack, I can get the bulk of my system administrator tasks completed without having to remember everything to install. This will also be a little test, because the rest of my network computers are running Raspberry OS and I’m doing this install on Ubuntu 20.04. So, let’s get SaltStack running and we’ll see what the differences are. (Spoiler: didn’t find any differences in the procedure.)
The minion can be downloaded from here. Salt actually makes an automatted install routine! It even works in our situation: Ubuntu 20 running on a armhf processor, so we can do the install really easily! Run these commands on each system that you want to manage using Salt.
curl -L https://bootstrap.saltstack.com -o install_salt.sh sudo sh install_salt.sh -P
You’ll see the curl command run and download the shell script. The next line runs that script and downloads what it needs and runs the install. If you get nervous about downloading scripts from the Internet and running them on your precious system (you should), you can follow the methods that I used to use that I outlined here.
After a couple of minutes, you should see:
Setting up python3-croniter (0.3.29-2ubuntu1) … Setting up python3-zmq (18.1.1-3) … Setting up salt-common (3001.1+ds-1) … Setting up salt-minion (3001.1+ds-1) … Created symlink /etc/systemd/system/multi-user.target.wants/salt-minion.service → /lib/systemd/system/salt-minion.service. Processing triggers for systemd (245.4-4ubuntu3.2) … Processing triggers for man-db (2.9.1-1) … Processing triggers for libc-bin (2.31-0ubuntu9.1) … INFO: Running install_ubuntu_stable_post() INFO: Running install_ubuntu_check_services() INFO: Running install_ubuntu_restart_daemons() INFO: Running daemons_running() INFO: Salt installed! root@ubu2:~#
The first thing I like to do after the install is complete, check the minion_id. Edit the file: /etc/salt/minion_id and make sure you see the expected hostname in there. The install process likes to tack the local domain name. I routinely delete it. Some people just copy the hostname file:
sudo cp /etc/hostname /etc/salt/minion_id
Check that the service is enabled:
root@ubu2:~# systemctl enable --now salt-minion.service 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 root@ubu2:~#
Looks great. Restart:
root@ubu2:~# systemctl restart salt-minion.service root@ubu2:~# systemctl status salt-minion.service ● salt-minion.service - The Salt Minion Loaded: loaded (/lib/systemd/system/salt-minion.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2020-10-09 12:25:58 EDT; 1s ago Docs: man:salt-minion(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltstack.com/en/latest/contents.html Main PID: 7573 (salt-minion) Tasks: 4 (limit: 4436) CGroup: /system.slice/salt-minion.service ├─7573 /usr/bin/python3 /usr/bin/salt-minion ├─7576 /usr/bin/python3 /usr/bin/salt-minion ├─7578 /usr/bin/python3 /usr/bin/salt-minion └─7630 [salt-minion]
Salt Master Tasks
It runs! Next, jump over to the salt master and run salt-key to see if we can grab the key:
root@salt:~# salt-key <<<snip>>> zero2 zero3 Denied Keys: Unaccepted Keys: ubu2 ubu2.local Rejected Keys: root@salt:~#
#winning! I’m going to delete the .local one and accept the naked one:
root@salt:~# salt-key -d ubu2.local The following keys are going to be deleted: Unaccepted Keys: ubu2.local Proceed? [N/y] y Key for minion ubu2.local deleted. root@salt:~# salt-key -a ubu2 The following keys are going to be accepted: Unaccepted Keys: ubu2 Proceed? [n/Y] y Key for minion ubu2 accepted.
Finally, go for the gold! Try to pull the kernel name for a simple test:
The Final Test
root@salt:~# salt 'ubu2' cmd.run 'uname -a' ubu2: Linux ubu2 5.4.0-1019-raspi #21-Ubuntu SMP PREEMPT Mon Sep 14 07:20:34 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux root@salt:~# salt 'ubu2' test.version ubu2: 3001.1 root@salt:~#
Hold your BINGO cards, Folks! We have a winner!
Next post, writing some initial sls files to try to control our new minion!