Overview

mass.pl is the implementation of a relatively simple idea. Instead of interactively doing some task on one machine, then duplicating the effort on N other machines, write a shell script, then scp it to N machines and execute it as root.

Features

Host name expressions

The argument to --name can now be an expression composed of groups of machines from names.pl (and single machines). For example, --name "web-machine1" takes the simple difference of web and machine1, where they're both either named groups (perl arrays from names.pl) or individual machines. Machines with dashes in the name can be escaped with single quotes or a backslash infront of the dash.

The operators are:

More examples: given names.pl like this:

@web = qw(web1 web2 web3);
@linux = qw(web2 web3 mail1);
@solaris = qw(web1 mail2 honey-pot);

Example session

(sic@foo)($:~/mass)- ./mass.pl --name 'solaris' --script pushsomething --su --sshpass
sudo password: 
ssh password: 

trying to run pushsomething on 1 machines
test

test

PING test.example.com (10.1.1.10) from 10.1.2.3 : 56(84) bytes of data.
64 bytes from 10.1.1.10: icmp_seq=1 ttl=64 time=0.142 ms

--- test.example.com ping statistics ---
1 packets transmitted, 1 received, 0% loss, time 0ms
rtt min/avg/max/mdev = 0.142/0.142/0.142/0.000 ms
pushsomething        100% |*****************************|   183       00:00    
test.txt             100% |*****************************|    15       00:00    
sic@test's password: sh-2.05a$ PS1='$ '; PATH=/usr/local/bin:/bin:/usr/bin:/usr/s;export PS1;export PATH
$ sudo -K ; sudo sh
Password:
$ PATH=/usr/local/bin:/bin:/usr/bin:/usr/sbin:/usr/local/sbin:/sbin ; export PATH
$ if [ `id|cut -d ' ' -f 1` = 'uid=0(root)' ]; then PS1='# '; fi
# sh pushsomething  && echo script\ done || echo script\ failed
script done
# /bin/rm pushsomething test.txt && echo removed\ pushsomething test.txt
removed pushsomething test.txt
# 

1 passed: test
0 failed: 
0 fatal errors: 

Files

mass.tar.gz Package of the next few files (mass.pl, names.pl, newusers.pl, pushsomething, userinfo.pl)
mass.tar.bz2 Same, but bzip2'd
mass.pl
names.pl Example machine names file
newusers.pl This file creates users on FreeBSD/OpenBSD, Linux and Solaris and sets up their homedir and .ssh/authorized_keys files. It works well with mass.pl.
userinfo.pl This is the info file used by newusers.pl
pushsomething A simple example shell script showing how to use "# send: " to put some file into /usr/local/bin with specific modes.

Required packages

These are available from CPAN as well.

Expect-1.15.tar.gz
IO-Stty-.02.tar.gz
IO-Tty-1.02.tar.gz
TermReadKey-2.21.tar.gz
Text-Balanced-1.95.tar.gz
Parse-RecDescent-1.94.tar.gz

Contact

I dislike spam, so this is a stupid javascript thing that pops up a window with my mailto:

Similar programs

Mass logo

Since some people wanted more graphics on my wabpaeg I decided to make a logo for mass.pl, so here it is: