SortingHat -- Which Server Do You Belong In?
John Spurgeon and Ed Schaefer
We are responsible for administering several servers distributed around the world. Each server is configured more or less the same way. However, a variety of attributes are unique to a particular server: nodename, IP address, default router, etc.
We developed a utility called changeident (Spurgeon & Schaefer, 2004) to facilitate the configuration of many server-specific parameters. The modules that comprise changeident typically update or replace existing files using variables and hard-coded logic. For example, changing the nodename of a server involves commands like "echo $new_nodename > /etc/nodename".
Some files, such as users' crontab files, are too complex for this approach. Instead, we use a Korn Shell script called SortingHat (see the
sidebar
"What's in a Name?"). SortingHat replaces existing files with copies of files that are preconfigured for specific servers.
The Directory Structure
The SortingHat script (
Listing 1
) makes use of several directories to manage and organize files:
SORTINGHAT_DIR=/opt/SortingHat
SERVERS_DIR=$SORTINGHAT_DIR/servers
DEFAULT_DIR=$SORTINGHAT_DIR/default
BACKUP_DIR=$SORTINGHAT_DIR/backup
CURRENT_DIR=$SORTINGHAT_DIR/current
The "servers" directory contains several subdirectories. The name of a subdirectory is the hostname of a server. And each of these subdirectories may contain more subdirectories and files. For example, a copy of the hosts.equiv file for a server named pongo would be located at:
/opt/SortingHat/servers/pongo/etc/hosts.e
|