You’re looking at ways to control a lot of servers at the same time. People usually make loops and run through, but there are applications if you want to get serious about it
Heres a loop example that will make a file in your home dir with the contents “omgwtf”:
Make your server list rather than typing all these servers into your for loop:
cat > serverlist.txt
server1.com
server2.com
server3.com
Do your loop (those are backticks):
for i in cat serverlist.txt
; do ssh username@$i “echo omgwtf > /home/username/rawrrr.txt” ; done
Now, that’s annoying because you have to type your users login name for every single server iteration.
Loose mentions using SSH keys. Do a google search on how to set this up, and you will be able to run through that command above without typing a password.
But then, if you’re smart, you won’t allow root logins via ssh. Or maybe you dont have root on all boxes, just sudo. Adding a “sudo echo omgwtf >…” will work, but you’ll hvae to type your sudo password for every iteration. That’s total balls too.
Along comes pexpect. pexpect is a collection of python scripts that can automate your workload by “expecting” to get a password prompt, and automatically sending your password. Check it:
noah.org/wiki/Pexpect
Pexpect makes life a lot easier, but you have to a learn a little bit of python. Don’t worry, python is in my opinion the easiest scripting language you can learn a useful amount of.
So, pexpect has some quirks. Like Loose said, some servers are always going to be stupid. And pexpect doesn’t handle sudo gracefully…i mean, it’ll do it, but not perfectly every time in my experience. Maybe i just suck at python. Regardless, we’re looking into a package called “Func”. It allows mass control over mass amounts of servers. Right now i use a modified “hive.py” script from the pexpect package, and it is wicked, but the way its programmed limits its abilities to connecting to 30 servers or less at a time.
Func on the other hand sounds pretty good, though I haven’t tried it out yet. Will soon. You can check it out here:
fedorahosted.org/func
NO it’s not just for fedora!
Anyways hope this helps in your mass-control efforts.