[rescue] off topic - red hat linux book

Ray Arachelian ray at arachelian.com
Wed Oct 21 13:54:04 CDT 2009

Patrick Finnegan wrote:
> GNU cfengine, Reductive Lab's Puppet, etc.  They're $0.
I just script things and have ssh rsa/dsa keys everywhere without
needing anything more than ssh.

I keep a list of machines with their attributes in a text file, then
setup my .bashprofile to build aliases to the hostname like so:

host1   solaris production newyork
host2   linux   qa  california

for i in `cat ~ray/machine_list | cut -f1 -d' '`
  alias $i="ssh -2 -i ~ray/.ssh/id_rsa $i"

So that lets me get on a box by name.  I could do without the -i param
to pass the key, but sometimes I'm sudo'ed to root so having it
explicitly there helps.
(this is off the top of my head, but that's what the scripts that do
this look like, just to give you an idea.  watch out for typos.  I don't
want to post the actual ones as they're on work machines and might fall
under ownership of $work even though I wrote them, though they're quite
obvious and generic.)

If I want to execute something on all or some of the machines I do this:

for i in `cat ~ray/machine_list | grep prod | cut -f1 -d' '`; do scp -o
"protocol 2" -i ~ray/.ssh/id_rsa -p /var/tmp/somefile.sh $i:/tmp/; ssh
-2 -i ~ray/.ssh/id_rsa ray@$i "sudo /var/tmp/somefile.sh; rm
/var/tmp/somefile.sh" 2>&1 >/tmp/ray/output/$i.out; done

Then of course I can look at the outputs of these and grep for fail or
success, etc.

There's also stuff like cluster-ssh if you want to open multiple windows
at once and have the same commands run everywhere, etc.

More information about the rescue mailing list