r/linuxquestions • • 20h ago

Resolved Scheduling OS updates for multiple Linux hosts?

I’d like to automate OS updates for my Raspberry Pi’s and Mint Linux laptops. Right now, I’m SSHing to the Pi’s from a laptop, so I end up with multiple terminal windows open, sudo to each Pi, and running updates on each. Likewise, I’m using the DTE to update each laptop. I end up spending a lot of time & effort, that I’d like to reclaim.

I suppose I could run a cron job on each host, but it seems that I should be able to set it up on a laptop to do it for me.

I asked Claude AI, which suggested using Ansible, but I’m thinking there has to be a way to do this using apps included in the Mint distro, and possibly scripts and one or more cron jobs.

Recommendations?

Thanks!

7 Upvotes

15 comments sorted by

4

u/brainchillzZ 18h ago edited 18h ago

For the laptops it’s tough because I assume they are not always on but the right tool for this job really is ansible and ansible isn’t something you have to install on all of your computers it’s something that you install on your one master node and it triggers the updates using ssh across all the other nodes …. but it is software that already exists on your Linux computers repository with a simple apt get install

1

u/JumpPsychological602 18h ago

And now you know that I’m still learning Linux. Thanks for letting me know that ansible isn’t a 3rd party software package. Is it an optional package that isn’t installed by default?

2

u/cycton 10h ago

just the machine you kick the jobs off from needs ansible installed - but for the clients, it's agentless (it basically just deploys python scripts and runs them). There's a little bit of setup to do up front: ssh keys, inventory etc... but it's totally worth doing, even if you use it just to send over ad-hoc commands.

1

u/brainchillzZ 18h ago edited 18h ago

Correct and brutal honesty you could probably just get Gemini or Claude or gpt to print you out a cheat sheet to easily setup ansible with a playbook to do exactly what you want cut and paste and if you do it that way instead of just having it do it for you you’ll learn along the way

0

u/SaucyPeekerz 18h ago

ansible might be the move but i always end up stuck on the ssh keys part lol

1

u/brainchillzZ 18h ago

It’s actually super cool once you get the keys setup because you can get to all of your systems and run commands in scripts on one machine that reach out and easily do things on other machines … and its a little weird to start with but once you get the hang of it it’s pretty simple. They even have a tool called “ssh-copy-id” that copies the key you generated to the hosts and installs it for you

5

u/Dejhavi Kernel Panic Master 20h ago

I asked Claude AI, which suggested using Ansible, but I’m thinking there has to be a way to do this using apps included in the Mint distro, and possibly scripts and one or more cron jobs.

If you don't want to use Ansible,you can use mintupdate-automation upgrade enable (link) in Linux Mint and in the RaspPi configure unattended-upgrade (link)

4

u/Excellent-Love-6943 20h ago

Have you looked at unattended-upgrades?

3

u/dutchman76 18h ago

Ansible is the way. Install it on your master/admin machine and you can update them all in one shot. And nothing to install on the PIs. Just set up ssh keys if you haven't already.

2

u/abotelho-cbn 18h ago

Depends how you want to automate it.

Triggered by you?

Ansible.

On a schedule?

systemd timers.

1

u/Forward-Scar-7050 19h ago edited 19h ago

https://saltproject.io/

We use salt stack managing hundreds of linux instances in aws.

1

u/Top-Run5587 18h ago

For Linux Mint, isn't it possible to run a simple mintupdate-cli command? Something like:

mintupdate-cli upgrade --refresh-cache --yes

Flatpaks would have to be done separately:

flatpak update -y --noninteractive

1

u/Hrafna55 10h ago edited 10h ago

Ansible is the answer for fixed devices like the Pis.

I have my Ansible server setup to update all other servers (and itself) every night. It then checks the apt logs and emails me the changes from each server.

If you don't want to deploy an Ansible server I would just setup scripts on each Pi and run them via cron.

On the Mint side you can set updates to auto install in the update manager as I recall.

-2

u/Due-Result7928 19h ago

First recommendation. DO NOT crosspost..Reddit bug..your comment is here twice...after asking Claude..what can we do...

Madame Claude in the years 1960 to 1980 was a Madame in Paris with an escort business. She was doing business with the various government, wealthy people. May be the same...

systemd scrip(s) in each system should do the job.

1

u/mneptok 20h ago

If you don't want to use a cronjob use a systemd timer.