Newer
Older
tsshbatch / tsshbatch.rst

NAME

tsshbatch - Run Commands On Batches Of Machines

SYNOPSIS

tsshbatch.py [-hvk] [-n name] [-p pw] [-H 'h1 h2 ...' | serverlistfile] command arg ...

DESCRIPTION

tsshbatch is a tool to enable you to issue a command to many servers without having to log into each one separately. When writing scripts, this overcomes the ssh limitation of not being able to specify the password on the command line.

tsshbatch also understands basic sudo syntax and can be used to access a server, sudo a command, and then exit.

tsshbatch thus allows you to write complex, hands-off scripts that issue commands to many servers without the tedium of manual login and sudo promotion. System administrators, especially, will find this helpful when working in large server farms.

OPTIONS

-h Print help information
-v Print detailed program version information and exit
-k Use ssh keys instead of name/password credentials
-n name Login name to use
-p pw Password to use when logging in and/or doing sudo
-H hostlist Single quoted list of hosts on which to run the command

ENVIRONMENT

tsshbatch respects the TSSHBATCH environment variable. You may set this variable with any options above you commonly use to avoid having to key them in each time you run the program. For example:

export TSSHBATCH="-n jluser -p l00n3y"

This would cause all subsequent invocations of tsshbatch to attempt to use the login name/password credentials of jluser and l00n3y respectively.

USE CASES

  1. Different Ways To Specify Targeted Hostnames

    There are two ways to specify the list of servers on which you want to run the specified command:

    • On the command line via the -H option:

      tsshbatch.py -H 'hostA hostB' uname -a

      This would run the command uname - on the hosts hostA and hostB respectively.

      Notice that the list of hosts must be separated by spaces but passed as a single argument. Hence we enclose them in single quotes.

    • Via a host list file:

      tsshbatch.py myhosts df -Ph

      Here, tsshbatch expects the file myhosts to contain a list of hosts, one per line, on which to run the command df -Ph. As an example, if you want to target the hosts larry, curly and moe in foo.com, myhosts would look like this:

      larry.foo.com
      curly.foo.com
      moe.foo.com

      This method is handy when there are standard "sets" of servers on which you regularly work. For instance, you may wish to keep a host file lis for each of your production servers, each of your test servers, each of your AIX servers, and so on.

  2. Authentication Using Name And Password

  3. Authentication Using Key Exchange

  4. Executing A sudo Command

    • Forces luser to type in pw

OTHER

You must have a reasonably current version of Python installed. If your Python installation does not install paramiko you'll have to install it manually, since tsshbatch requires these libraries.

BUGS AND MISFEATURES

None known as of this release.

COPYRIGHT AND LICENSING

tsshbatch is Copyright (c) 2011 TundraWare Inc.

For terms of use, see the tsshbatch-license.txt file in the program distribution. If you install tsshbatch on a FreeBSD system using the 'ports' mechanism, you will also find this file in /usr/local/share/doc/tsshbatch.

AUTHOR

Tim Daneliuk
tsshbatch@tundraware.com

DOCUMENT REVISION INFORMATION

$Id: tsshbatch.rst,v 1.102 2011/12/30 16:53:02 tundra Exp $

You can find the latest version of this program at:

http://www.tundraware.com/Software/tsshbatch