Index of /log/Code/mass-upgrader

Me

Categories

Archives

2007-Oct
2007-Sep
2007-Jul
2007-Jun
2007-May
2007-Apr
2007-Feb
2007-Jan
2006-Dec
2006-Nov
2006-Oct
2006-Sep
2006-Aug
2006-Jul
2006-Jun
2006-May
2006-Apr
2006-Mar
2006-Feb
2006-Jan
2005-Dec
2005-Nov
2005-Oct
2005-Sep
2005-Aug

Tue, 21 Nov 2006

Mass Machine Upgrader

I maintain a few servers for people, and every time a security upgrade comes out, I have to ssh to each of them, apt-get update; apt-get dist-upgrade and wait. So I wrote a small script to automate this.

It requires a directory named log in your home directory (to write the logs to), and a file called upgrade-hosts.conf in a directory called etc, also in your homedir. It also depends on a private RSA-key in ~/.ssh/id_rsa.

Running the script will start an ssh-agent, and ask you for the passphrase of your RSA key once. Then it will ssh to all machines listed in the config file, and execute a command (some apt-get stuff) to upgrade the machine. Everything gets logged in files in the ~/log directory.

The config file should look something like this:

hostname1  some comment
hostname2  some other comment
Your script will fail if there are any interactive questions during the upgrade ... you need to add the '-t' ssh option to open a pseudo-tty, otherwise those questions cannot be answered.

Posted by davee at Wed Nov 22 16:07:08 2006 from 163.1.168.25

Fixed :)

Posted by Martijn at Wed Nov 22 16:16:36 2006 from 194.109.1.46

Leave a comment



foodfight.org index


Creative Commons Licentie Op dit werk is een Creative Commons Licentie van toepassing.