How to maintain a fleet of Raspberry Pis at home?

Auto-Update

I have 16 Raspberry Pis currently active at home. I’d like to find some way of updating them and monitoring their status with the click of a button. Something where there’s a button that says “update” or maybe it even auto-updates for me!

SSHing into a fleet of devices

The other issue I have is I need to SSH into each one. Wow, that’s painful. I use Windows, so I’m stuck with PuTTY, but it also has native SSH support as well. Is there some easy way of opening up an SSH session to maybe install new software or change a setting?

Reasoning

This has been a long time problem for the last 7 years, and it’s getting to the point where I think “Raspberry Pi” and dread the idea.

auto-update differs from distro to distro. And we don’t know what you are using. For e.g. Rocky (I know that’s available on RPi), just install dnf-automatic (EPEL? not sure) and edit the .conf file (/etc/dnf/something) if necessary, done.

Otherwise…the Pro people use Ansible to make changes to a fleet of machines. It’s rather complicated, which is why I just know some basics.

Bash script can maybe cover all your needs as well.

I’m using Raspbian Lite (the CLI one) for all of these.

I haven’t yet deviated into other distros. In the past, stuff on my Pi simply didn’t work, so I gave up trying other ones.

I used Ansible for that in the past. Because running it on Windows isn’t that great, I would make one Pi the “orchestrator” and run the playbook from there. Or use WSL or a VM on your Windows machine.

I have auto updates on mine for the OS and Watchtower for containers. I rarely have to SSH into it.
But, in your case, I think you should have some kind of dashboard to look over the whole fleet at a glance, just in case.

If you need to SSH into multiple machines and run the same command MobaXTerm allows you to mirror what you’re writing to multiple terminals at once.

Some tech youtuber (LTT I think) was sponsoring a managment tool for deployment, maybe you should think about using one of those instead of going manually into each machine.

I’d love a management platform, but I’d like to run it locally, not in the cloud. I don’t like having someone else with a hard-to-find attack vector into my network.

You definitely want Ansible. It’s built for this exact purpose. It took me about three hours to learn it from scratch.

That’s how I remember it as well. Hardest part is getting the ssh pubkey onto the Pis, the playbook for checking updates, installing them and rebooting was up and running within minutes.

I later opted for a fresh install and do everything through ansible, luckily the Raspberry Pi Imager lets you put the pubkey onto the SD card, together with the desired hostname

Sounds like Ansible is a possible avenue as well :+1:.

I’d really prefer a web interface that accumulates all machines and basically lets me see the OS version, upgrade packages, and check for issues.

I could try setting up cron jobs again that automatically update, but I’ve never had great experience with those cron jobs actually updating the machines consistently in the past.

And I’d have no way of knowing if there were any issues either without somewhere to log errors.

I use Tabby (in Windows) for easy SSH bookmark, user (and pass), settings sync between different Windows machines I use.

Wow! Tabby looks like a great tool in general :). I’ll definitely be trying that out over my dated PuTTY versions.

At scale, I’d really like something with a UI. I wonder if there are generic Linux monitoring tools kinda like TrueNAS has TrueCommand.

I could build the UI myself in JavaScript, but I’d need an API to hook into. If I could have all these servers reporting to a centralized server, that server could expose an API. SNMP does this right? But that’s just logging, not machine info.

LogMeIn had a software like this over 10 years ago. Not sure what’s going on there. But you could remotely update and access Windows PCs with it.

Maybe what I’m asking for is just Ansible to program multiple Raspberry Pis at once or a simple cron update task :/.

There you go:

Ansible has it all.

I thought about this some more, and this is what I want:

  1. I’d also like a centralized location to do OS updates and check CPU and RAM usage; maybe see running processes as well, change the hostname, etc. My goal is to keep these up-to-date and secure.
  2. I want to be notified if something happens to the device like it’s rebooting a bunch or logging errors or has high CPU or RAM.
  3. I want to be able to access files from the UI such as config files. I have some Raspberry Pis for battery monitoring using NUT. If I could expose those /etc configs in the UI, I can change them without SSH like I could do with a Home Assistant config.
  4. I’d also like to be able to restart certain services. “This uses NUT. I want to restart it” from the UI.

So when I say fleet management, this is what I’m thinking. Purpose-built UI for managing a fleet of similar servers.

I basically want something like Home Assistant where it can be a purpose-built OS for each device, but since they’re running Raspberry Pi OS Lite, I have to manage each one myself.

I even have a Raspberry Pi running Pi-Hole, and the issue is I can update Pi-Hole from the web interface, but not the OS. Having somewhere to accumulate all my devices would be incredible. Bonus props if I could do it from Home Assistant :stuck_out_tongue:.

Ansible

Ansible is another piece of the puzzle. It lets you program multiple devices at once. Not sure about monitoring. This lets you have “dumb” devices which are more like appliances. Is that right?

I really don’t know about Ansible except that it’s complicated and seems daunting to get started. Docker and Docker-Compose were always way simpler for me to manage, but they don’t make sense when I’m dealing with actual hardware and devices.

My devices are already setup, and when I add a new one, that’s where Ansible could come in handy.

Now I know what I’m thinking of. Systems like UniFi and ESPHome are also in this bucket. Both let you basically have dumb devices that are programmed remotely, but you can monitor them in the UniFi or Home Assistant systems.

It’s very hands-off. I don’t want a full-OS Linux install, I want what is essentially a purpose-built Docker container as the OS.

If Ansible does this, then that’s my ticket!

Then you are looking for different solutions. If you want to host everything yourself, your stack will be quite complex.

I would still recommend using Ansible for configuration management.

For the rest, you have multiple options:

  • Loki (Logs) and/or Prometheus (Metrics) + Grafana. You can also configure alerts in Grafana.
  • Use a VS Code Server with the Project Manager extension, and configure all your PIs as SSH Remote Targets to edit files directly in the browser.
  • Rebooting/restarting services can also be handled by Ansible.
  • For basic functionality, you can also consider using Cockpit.
  • Alternatively, take a look at CheckMK. I haven’t used it myself, but it might cover most of your needs, minus configuration management.

I bet there are a bunch of other solutions, but the are the ones I used / see others use in most cases.

First hit on google:

You can force ansible to do a lot of things, but I would start small. If you try to do all of this at once it will be overwhelming.

Start with a Ansible Playbook that updates all your PIs, install AWX and run the playbook from there, Setup your Log / Metric - Monitoring Stack, etc.

It depends how far you want to take your “maintenance” of your pis. If you just want bare basic updates, just install a terminal multiplexer (I prefer dvtm, there’s also screen and tmux, which the latter 2 doing both multiplexing and session management) on one of the pi, use putty to ssh into that and from that, run your multiplexer and ssh into all of them, then use the built-in feature to run the same command on all the open terminals (I believe there’s also a way in some multiplexers to save your ssh sessions, or script them to open all the SSH sessions with 1 command). Then update them manually, there.

For anything debian-based, install unattended-upgrades, if you don’t want to manually update things.

For anything more complicated, you could use one of the pis to install a monitoring software, like zabbix (which has an aarch64 .deb package) and set up alerts. The alerts can be as simple as running an update check, to see if any updates are available, then either give you an alert on which you can acknowledge and fix yourself, or have the “monitoring software” automatically run predefined fixes (and tell you if it failed to “recover”). All in a web gui.

If you want even more advanced stuff: ansible (or automate your way with cron and pssh or something, but by that point, if you want auto-updates, just use unattended-upgrades).

Ansible or Saltstack would be my tools of choice for mass management.

Sounds like you want kubernetes: abstracting the operating system entirely while just taking care of managing the services themselves.

It won’t give any of your UI requirements by default tho, and is way too complicated for someone with no previous experience.

unattended-upgrades

I’d forgotten about unattended-upgrades. I went ahead and installed it on all my Raspberry Pis. This helps with keeping things up-to-date, but it doesn’t provide visibility.

Monitoring Tool

Anisible

Seems like everyone’s pointing at Ansible, but there’s no UI right? It’s all CLI from what I remember.

I found a few solutions (one being an Ansible UI), and I’ll post again if those work for me. I’ve even looked at integrating this into Home Assistant.

My updated needs

After thinking about it more and more, these are the things I’m looking for:

  1. Is the Pi on or available over the network (same thing)?
  2. Are the services I expect running?
  3. What versions is it running? Are there updates available including the OS release that I may need to address because it didn’t auto-update?
  4. Easy way to SSH into multiple machines.

If I had those first 3, that’s enough visibility for me. A UI that’d gimme that information would be great. Being able to SSH in seems like it could be done with a separate app.

Home Assistant for monitoring

Home Assistant is the ideal situation for me.

It comes with a customizable dashboard and allows you to write automations for entities (like a Pi being outta date).

Since I use these Raspberry Pis for software that already appears in Home Assistant (NUT, Pi-Hole, Home Assistant, OpenWRT), I wouldn’t need to know which services are actively running; I can use Home Assistant integrations for that purpose.

I could do this provided I had some hookup for Linux to show up in Home Assistant. There are some solutions out there, but I don’t know any that can tell me the OS version outta-dateness.

I could write that myself provided I had a way to know the current OS version and the version on that Pi.

SSH solutions

Tabby

As far as I understand, I can use Tabby to setup a profile that’ll SSH into all my Raspberry Pis.

Haven’t tried this particular use case yet, but I’m thinking of switching over to this terminal.

VSCode

I could also try using a VSCode workspace that sets up all the terminals, but not sure it can SSH into them.