Notes on Upgrading Salt
Objective:
I wanted to bring all my salt minions up to the current release. Upgrading minions is not something I do frequently so I tend to forget the process, and this post is to collect my notes so the next time is easier or something I take the time to automate.
Identify Book of Work
Book of Work, a term ripped from BNYM corporateese circa 2018-2019, meaning what needs to be done.
- Identify all minions
- On salt master run
sudo salt-run manage.status
![status][minion-status]
All minions show up and running, so now it is time to get to work.
- On salt master run
- Get minion versions.
- On master run
sudo salt-run manage.versions
. ![current minion versions][salt-current-versions]
And it looks like 18 minions need an upgrade, yet none as much as miniondylan-c2
which is sporting an agent for 2014. As upgrading the oldest client will likely present the greatest set of ‘opportunity’ we will start with it.
- On master run
- Find out what we are dealing with by executing
sudo salt dylan-c2\* grains.item osfullname oscodename osrelease
on master. ![dylan-c2 os info][salt-dylan-c2-os]
Debian
- When upgrading from a version earlier than 2015.8.4, the
/lib/systemd/system/salt-minon.service
file on the minion needs to be edited, addingKillMode=process
to the[Service]
section of the file. - Next also on the minion run the following command
wget -O - https://repo.saltstack.com/apt/debian/8/armhf/archive/2019.2.0/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
to import the Saltstack public key for the latest ARM repository. - Next create a
saltstack.list
file in/etc/apt/sources.list.d/
folder and add the following information to itdeb https://repo.saltstack.com/apt/debian/8/armhf/archive/2019.2.0 jessie main
- On the minion run
sudo apt update
anssudo apt upgrade -y
to install the latest version of the salt minion. - Complete the upgrade by restarting the
salt-minion.service
withsudo systemctl restart salt-minion.service
.
![dylan-c2 up to date][salt-dylan-c2-done]
-
Find out what we are dealing with next executing
sudo salt ceed-carmen\* grains.item cpuarch osfullname oscodename osrelease
on master.![ceed initial][ceed-info]
Raspbian
- On the minions
ceed-*
run the following commandwget -O - https://repo.saltstack.com/apt/debian/9/armhf/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
- Next create a
saltstack.list
file in/etc/apt/sources.list.d/
folder and add the following information to itdeb https://repo.saltstack.com/apt/debian/9/armhf/latest stretch main
- On the minion run
sudo apt update
anssudo apt upgrade -y
to install the latest version of the salt minion. - Complete the upgrade by restarting the
salt-minion.service
withsudo systemctl restart salt-minion.service
.
![ceeds up to date][ceed-done]
Ubuntu on ARM
- On master, get information about minion with
salt mitchell\* grains.item cpuarch osfullname os codename osrelease
![mitchell_info][mitchell-info] - On minion, remove existing salt minion with
sudo apt remove salt-minion salt-common -y
- On minion, make bootstrap directory,
sudo mkdir -p /opt/projects/salt
- Change to working directory,
cd /opt/projects/salt
- Get bootstrap script with
sudo curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com
![get_bootstrap][get-bootstrap] - Bootstrap to desired version with
sudo sh bootstrap-salt.sh -r -P git v2019.2
. As the Saltstack team only maintains arm packages for Debian and Raspbian, the salt-minion has to be compiled for source on Ubuntu and other operating system and platform combinations for which packages are not available.
![bootstrap_compile][bootstrap-compile] - Unmask service with
sudo systemctl unmask salt-minion
- Enable service with
sudo systemctl enable salt-minion
- On master remove old minion key with
sudo salt-key mitchell.grimmig.mine.nu
- On minion start service with
sudo systemctl start salt-minion
- On master accept minion key with
sudo salt-key -a mitchell.grrimmig.mine.nu
- On Minion restart service with
sudo systemctl restart salt-minion
Conclusion
After repeating the steps above1 as necessary for each of the remaining minions in the list I achieved my goal of having all Salt managed minions running the current and same version as the Salt master.
![the_end][the-end]
\images [minion-status]: /assets/images/salt-minion-status.png [salt-current-versions]: /assets/images/salt-current-versions.png [salt-dylan-c2-os]: /assets/images/salt-dylan-c2-os.png [salt-dylan-c2-done]: /assets/images/salt-dylan-c2-done.png [ceed-info]: /assets/images/salt-ceed-info.png [ceed-done]: /assets/images/salt-ceed-done.png [pc-info]: /assets/images/salt-pc-info.png [mitchell-info]: /assets/images/mitchell-info.png [get-bootstrap]: /assets/images/get-bootstrap.png [bootstrap-compile]: /assets/images/bootstraping.png [the-end]: /assets/images/and-in-the-end.png
\footnotes
-
Because of the length of this post there were a couple of omissions in the steps above for minions which had packages available, notably there are Ubuntu packages for the x86-64 architecture, as well as for the MacOS. Smart use of search engines will fill in any gaps. ↩