2

Let's say you have 24 computers. They all have the same Linux or Unix distro on them, with the exact same configuration, but with different users. Is there a way to be able to do the exact same thing on all of them with one command? For example I'm running Lubuntu 14.04 and 14.10 comes out and I want to upgrade all of them while only running sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade once? Is there a software that would allow me to do that?

psimon
  • 1,212

2 Answers2

2

I use ClusterSSH. I also use it to administer groups of machines, not just all of them at the same time. That is, I set up shell aliases to open, for example, just the name servers, or just the mail servers, or just the Web servers, etc. Careful! This tool will give you an appreciation for configuration management. There's a nice article on Linux.com.

Christopher
  • 15,911
0

I would write a small BASH script for that manually. A simple for loop can do it for you:

#!/bin/bash

for $host in IPs OF REMOTE HOSTS SPACE SEPARATED
do
   ssh root@$host 'remote command eg. apt-get upgrade'
done
psimon
  • 1,212
  • That is highly inefficient in large scale deployment, as the commands are done serially. Personally I like psh but that's xcat specific. Basically any concurrent ssh will do and see http://serverfault.com/questions/17931/what-is-a-good-modern-parallel-ssh-tool – Dani_l Jul 18 '14 at 09:45
  • @Dani_I what about running them parallel with an additional & ? – psimon Jul 21 '14 at 17:20
  • you'll need to run ssh -n user@host '...' & – Dani_l Jul 21 '14 at 21:37
  • might work, but no easy control of sliding window - how many parallel tunnels would you like to run at any given time? most parallel execution shells allow for easy setting of this value. It can be done in shell (I wrote something similar years ago) but really not worth the headache. You have to monitor the connections, and start a new one for each one that finishes... – Dani_l Jul 21 '14 at 21:41