massh(1)massh man page massh(1)NAME
Massh - Run Commands, Run Scripts, Push Files, Pull Files - Paral‐
lelized
SYNOPSISmassh [FilePath] terse [RemoteCommand]
massh [HostGroup] push [FilePath]
massh [HostGroup] worked [RemoteCommand]
massh [HostGroup] [RemoteCommand]
massh [HostString] verbose [RemoteCommand]
massh list options
massh edit option [OptionName]
DESCRIPTION
Massh makes it possible to perform the following on hundreds, or even
thousands of hosts in a parallelized fashion:
Run Remote Commands
Push and Execute Pre-Written Scripts
Push Files
Pull Files
Massh uses Ambit to enumerate a list of targets for which it will exe‐
cute one of the aforementioned operations. Hosts can be logically
grouped and dynamically managed allowing for consistent operational
changes and overall managmenet of identically purposed hosts.
Massh can display the full output resulting from its various operations
or it can be set to display an operation's success or failure for indi‐
vidual target hosts. The full ouput produced by Massh is completely
organized and labeled by host, regardless of what order output is
returned from target hosts.
Starting with version 2.x Massh combines flexible option control man‐
agement and a simplified command + subcommand sytax. This reduces the
complexity of typical Massh commands and makes it much easier to learn
how to perform specific operations with specific options with Massh.
Massh's simplified CLI sytax can be be broken down in the following
way:
COMMAND => OPTION + SUBCOMMAND => SUBOPTION
========================================================================
massh allhosts verbose gpasswd -a mm wheel
massh db[1..30] push my.cnf
massh hosts.txt worked sudo service restart httpd
Syntax Breakdown
COMMAND
The Massh executable itself.
OPTION
Currently the values that are valid for OPTION are those that can be
understood, expanded and enumerated by Ambit:
Command ARG
An command line argument in the form of an Ambit expandable
string. Example: [web,db,app][1..10].somedomain.com
Hostfile in $PWD
If a file in the user's current working directory ($PWD) con‐
tains hostnames (one per line) or Ambit expandable strings it
can be passed to OPTION by its name (full path not needed).
Path to Hostfile
If a file located somewhere on the current host contains host‐
names (one per line) or Ambit expandable strings it can be
passed to OPTION by listing the files full path.
User HostGroup
Users can create personal or User HostGroups (via Ambit) that
can be passed to OPTION by name.
System HostGroup
Users with root access can create System HostGroups (via Ambit)
that all users on the system can pass the OPTION by name.
Network HostGroup
Network accessible HostGroups can be established by creating a
DNS TXT record containing an Ambit expandable string. Ambit will
check for such records if the 'Domain' Ambit option is set. The
shortname for the aforementioned DNS TXT records can be passed
to OPTION. Example: The domain a.tt has the following TXT record
to establish a Network HostGroup for the Yum package reposito‐
ries:
$ host -t TXT yum
yum.a.tt descriptive text "[1..3].a.tt"
This mean the HostGroup's name (yum) can be passed to OPTION.
SUBCOMMAND and SUBOPTION
The SUBCOMMAND is a one word descriptive indicator that best describes
the overall operation that Massh will be performing. A SUBOPTION will
either be a command (to be run on target hosts) or a filename (i.e.
file to be pulled, pushed or containing a script to be executed). The
following are possible SUBCOMMANDS:
terse SSH to all targets enumerated from OPTION, execute the command
stipulated by SUBOPTION and display only the success or failure
of the executed command.
verbose
SSH to all targets enumerated from OPTION, execute the command
stipulated by SUBOPTION and display the full output resulting
from the command.
worked SSH to all targets enumerated from OPTION, execute the command
stipulated by SUBOPTION and display only the hostnames where the
command executed successfully.
bombed SSH to all targets enumerated from OPTION, execute the command
stipulated by SUBOPTION and display only the hostnames where the
command failed.
push SCP the file stipulated by SUBOPTION, to all targets enumerated
from OPTION.
pull SCP the file stipulated by SUBOPTION, from all targets enumer‐
ated from OPTION.
execute
SSH to all targets enumerated from OPTION, piping the script
stipulated by SUBOPTION to all targets enumerated from OPTION,
execute the script and display the success or failure of the
executed command.
OPTIONS
Starting with version 2.x Massh establishes a system wide option base‐
line that can only be changed with root privileges, but can be overrid‐
den by users on a per user basis. Massh provides the ability to view
and edit options via simple interactive dialogues.
Option Controls
list options
List both System and User Tunable Options.
edit option
Edit or Set a User Option. User options override System Options.
SHORT COMMANDS
Massh supports abbreviate command sytax for its Option Controls:
massh list options
massh ls opts
massh show opts
massh edit option [OptionName]
massh ed opt [OptionName]
SPECIAL HOSTGROUP
There is a special User HostGroup called 'results'
($HOME/.massh/hosts/results) that will contain the results of the SUB‐
COMMAND's 'worked' and 'bombed', along with a time stamp of the time
the command was run and the command itself. This is mostly to address
anything that 'bombed' during Massh runs where 100% success was either
expected or required. Ambit will not show this group by default when
running: ambit list hostgroups. Nor will Ambit know it exists since it
is not in any of Ambit's data paths. If you would like this group to be
listed simply hard link it to ($HOME/.ambit/hosts/results):
$ ln $HOME/.massh/hosts/results $HOME/.ambit/hosts/results
$ ambit list hostgroups | grep results
results: 2011-07-11 09:26:10 grep massh grep Marschall /etc/passwd
EXAMPLESmassh all verbose uptime
massh all.a.tt execute chkrrdprogress
massh app[1..10] push /etc/my.cnf
massh /tmp/newhosts.txt verbose yum install puppet
massh webhosts execute /srv/scripts/cross-site-scripting-check.sh
massh webhosts pull /var/log/httpd/access_log
BUGS
Fleas, Adam Had 'em.
AUTHOR
Mike Marschall (mm@a.tt)
2.0 08 Jul 2011 massh(1)