recovering a complete config from rancid

From time to time, I need to access a complete config stored by the rancid application under CVS, so I can get a good look (more than just the line diffs) at the configuration.

Here are the steps I use to recover an older version of configuration stored by the rancid process in a CVS structure.

1) Find the group that contains the config you want, and get the ‘CVSROOT’ directory info contained in the Root file. This should be in a directory that corresponds to the rancid base install directory — BASEDIR/var/GROUPNAME/configs/CVS/Root. My install base is /usr/local/rancid, so to get a config from my atlanta-zone5 group, I need to look in /usr/local/rancid/var/atlanta-zone5/configs/CVS/Root.

$ cat /usr/local/rancid/var/atlanta-zone5/configs/CVS/Root

2) Next, set and export the CVSROOT variable that you found in step 1.

$ export CVSROOT=/usr/local/rancid/var/CVS

3) Find the version of the file (the configuration revision) you want to get back. This can be done with various CVS front ends, or the command line. For the command line CVS command, go to the configs directory of the group containing the router/switch config you want, then use the ‘cvs log’ command. For example:
$ cd /usr/local/rancid/var/CVS/atlanta-zone5/configs/

4) Look through the log for the version that corresponds to the date you need:
$ cvs log bgp2-rtr | more

5)Go to the directory in which you’ll expand the old config.
$ cd /tmp (or some other directory where you won’t collide with existing files)

6) Check out the version you need using the ‘cvs co’ command in this form:

$ cvs co -r 1.21 GROUP/configs/YOUR_ROUTER
cvs co -r 1.21 atlanta-zone5/configs/bgp2-rtr

The group directory will be restored, and you will have to descend into it to find the exact config you need.

$ cd atlanta-zone5/configs
$ more bgp2-rtr

7) Enjoy your recovered config. Repeat as necessary.