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.

  1. 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.
  2. 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 minion dylan-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.
  • 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

  1. 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, adding KillMode=process to the [Service] section of the file.
  2. 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.
  3. Next create a saltstack.list file in /etc/apt/sources.list.d/ folder and add the following information to it deb https://repo.saltstack.com/apt/debian/8/armhf/archive/2019.2.0 jessie main
  4. On the minion run sudo apt update ans sudo apt upgrade -y to install the latest version of the salt minion.
  5. Complete the upgrade by restarting the salt-minion.service with sudo 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

  1. On the minions ceed-* run the following command wget -O - https://repo.saltstack.com/apt/debian/9/armhf/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
  2. Next create a saltstack.list file in /etc/apt/sources.list.d/ folder and add the following information to it deb https://repo.saltstack.com/apt/debian/9/armhf/latest stretch main
  3. On the minion run sudo apt update ans sudo apt upgrade -y to install the latest version of the salt minion.
  4. Complete the upgrade by restarting the salt-minion.service with sudo systemctl restart salt-minion.service.
    ![ceeds up to date][ceed-done]

Ubuntu on ARM

  1. On master, get information about minion with salt mitchell\* grains.item cpuarch osfullname os codename osrelease ![mitchell_info][mitchell-info]
  2. On minion, remove existing salt minion with sudo apt remove salt-minion salt-common -y
  3. On minion, make bootstrap directory, sudo mkdir -p /opt/projects/salt
  4. Change to working directory, cd /opt/projects/salt
  5. Get bootstrap script with sudo curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com
    ![get_bootstrap][get-bootstrap]
  6. 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]
  7. Unmask service with sudo systemctl unmask salt-minion
  8. Enable service with sudo systemctl enable salt-minion
  9. On master remove old minion key with sudo salt-key mitchell.grimmig.mine.nu
  10. On minion start service with sudo systemctl start salt-minion
  11. On master accept minion key with sudo salt-key -a mitchell.grrimmig.mine.nu
  12. 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

  1. 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.