- SAMPLE CONFIGURATION
- SEE ALSO
- COPYRIGHT AND LICENSE
clad - A simple parallel ssh client.
clad [log options] [-n] [-a] [-l login] <cluster> <command>
clad provides the ability to run the same command on several hosts at once. The output is displayed unbuffered as the various hosts run the command. The list of hosts is determined by reading a configuration file which associates names of clusters with lists of hosts. The configuration file may also contain command aliases and environment settings.
The command(s) will be executed under '/bin/sh -e' regardless of the login shell for the remote user.
Cluster-specific and global environment settings
Event-driven unbuffered output (using Mojo::Reactor)
Host chaining support
Perlish configuration for dynamic cluster settings
Filtering of banners
Dry run, just show the command that would be executed and each host.
Don't colorize the host names in the output.
Specify a login name for all ssh connections (proxies, too).
clad -n mailhosts uname -a clad webservers df -kh clad --trace root webservers ping -i 1 localhost
env : environment settings for all commands run on all hosts.
clusters : specifies the clusters. A cluster is a label and a list of hosts. Each host can be either a hostname or an array of hostnames. If it is an array of hostnames it will be treated as a sequence of hosts through which to proxy, e.g.
ssh host1 ssh host2 ssh host3...
If the first proxy host is the same for all the hosts in a cluster, then it can be given separately (see the example below).
aliases : command aliases. These may be either a single command or a list of commands. Lists of commands will all be run in the same ssh session. Environment variables in the env section will be merged with the global environment settings.
macros : command macros. These are a sequence of commands or aliases. They will be executed in sequence, starting a new connection with each one. Each command/alias may also optionally have a login associated with it.
banners : banners which should be suppressed when displaying stderr.
A sample configuration file ~/etc/Clad.conf :
--- env : PATH : /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/bin PERL5LIB : /home/joe/perl5 clusters : mailers : - mail1 - mail2 - mail3 webservers : env : USER : bob hosts : - web1 - web2 testweb : proxy : test.example.com hosts : - testweb1 - testweb2 aliases : check_ports : lsof -i -n startweb : nginx start stopweb : nginx start restartweb : - apachectl stop - apachectl start config_pull : - cd /usr/local/etc - git pull build : - cd project - perl Build.PL - ./Build - ./Build test - ./Build install macros : release : - login : joe command : build - login : dev command : restartweb banners : - text : | ********************************************** This is a welcome banner that you see whenever you ssh to our server! ********************************************** \n \n
Another example, using some Mojo::Template features :
--- env : PATH : /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/bin PERL5LIB : /home/joe/perl5 clusters : mailers : [ <%= join ',', map "mail".$_, 0..10 %> ], webservers : [ <%= `/usr/local/bin/list_my_web_servers` %> ]
Manipulating .ssh/config can also be used for proxying. For instance :
Host webdev1 ProxyCommand ssh firewall.example.com nc %h %p Host webdev2 ProxyCommand ssh firewall.example.com nc %h %p
original author: Brian Duggan
current maintainer: Graham Ollis <firstname.lastname@example.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by NASA GSFC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.