What’s the Best Way to SSH into a Large Number of Devices?

0
16
Asked By TechieDude48 On

I'm dealing with a situation where my company has about a thousand vending machines out in the field. Recently, we've identified an issue: many of these machines are running the 'develop' branch of our kiosk application instead of the 'production' branch. The fix is simply switching the git branch to production, but here's the catch: approximately 700 of the machines need this change. My team spent a whole day manually SSH'ing into each device to solve the problem, and this isn't the first time we've faced such a situation. I'm curious if there's a more efficient way to send the same command to multiple SSH addresses simultaneously or if there are tools available that could help with this issue. Has anyone encountered a similar challenge and how did you handle it?

5 Answers

Answered By PythonWizard23 On

If you’re comfortable with scripting, you could write a Python script that takes a list of the devices, SSHs into each one, and runs the necessary commands. However, tools like Ansible or even Powershell are definitely more efficient if you're managing a decent number of devices.

ScriptingGuru30 -

Absolutely! Ansible shines in scenarios just like this.

Answered By ScriptMaster99 On

You should definitely look into using Ansible for this. It's designed for managing multiple devices and could have you making those changes across all machines in minutes instead of hours. Just set up an inventory and you'll be good to go!

CodeNinja42 -

Totally agree with you! Ansible makes everything way easier for tasks like this.

Answered By AdminExpert77 On

You could also use something like dsh. It allows you to connect to several machines at once and execute the same command. I’ve had success using it for large fleets! Check out the dsh documentation for more info.

Answered By OldSchoolCoder54 On

Back in the day, I used Perl with Parallel::Forkmanager for situations like this. Just wrote a script once, and it handled everything by forking off copies to fix multiple devices at once! It was a lifesaver before tools like Ansible came along.

Answered By DevOpsMaster84 On

Another option is setting up SSH to use key-based authentication instead of passwords. It simplifies the process immensely. Plus, you can run a bash script to loop through your list of devices and execute the commands you need.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.