AS201281 Wiki

Your check engine light is on!

User Tools

Site Tools


sysadmin:backups

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
sysadmin:backups [2013/09/29 22:30] – created Guillaume Mazoyersysadmin:backups [2021/01/04 20:41] (current) – external edit 127.0.0.1
Line 11: Line 11:
 ===== RANCID ===== ===== RANCID =====
  
-FIXME+==== Installation ==== 
 + 
 +First we need to install RANCID, Subversion (that will be used a VCS) and Apache 2 to have a WebSVN instance available. 
 +<code>apt-get update 
 +apt-get install rancid subversion apache2 php5</code> 
 + 
 +==== Configuration ==== 
 + 
 +In the ''/etc/rancid/rancid.conf'' file do the following things: 
 + 
 +  - Modify <code>CVSROOT=$BASEDIR/CVS; export CVSROOT</code> by <code>CVSROOT=$BASEDIR/SVN; export CVSROOT</code> 
 +  - Modify <code>RCSSYS=cvs; export RCSSYS</code> by <code>RCSSYS=svn; export RCSSYS</code> 
 +  - Add <code>LIST_OF_GROUPS="gravitons"</code> 
 + 
 +''gravitons'' will be a directory where the devices configurations will be stored. 
 + 
 +Initialize the SVN repository where the changes will be tracked: 
 +<code>su - rancid 
 +./bin/rancid-cvs</code> 
 + 
 +The ''gravitons'' directory will be created. 
 + 
 +==== Handling Cisco Small Business devices ==== 
 + 
 +RANCID does not support Cisco Small Business devices by default. It requires some hacks to be able to backup the changes of a SG series devices (for example). As root run the following commands: 
 +<code>cd /var/lib/rancid/bin 
 +wget 'https://raw.github.com/chrpinedo/rancid-cisco-sb/master/src/csblogin' -O csblogin 
 +wget 'https://raw.github.com/chrpinedo/rancid-cisco-sb/master/src/csbrancid' -O csbrancid 
 +chmod a+x csb*</code> 
 + 
 +Also edit the ''rancid-fe'' in ''/var/lib/rancid/bin'' to add the following item in the ''%vendortable'' dictionary. 
 +<code>'cisco-sb'  =>  'csbrancid'</code> 
 + 
 +==== Add device to backup ==== 
 + 
 +Using the rancid user, create the ''.cloginrc'' file in the home directory and add the following lines to backup a Small Business device: 
 +<code> 
 +add user       sw0.gravitons.in  noc 
 +add password   sw0.gravitons.in  noc-password 
 +add autoenable sw0.gravitons.in 
 +add method     sw0.gravitons.in  ssh 
 +add userprompt sw0.gravitons.in  {"User Name:"
 +</code> 
 + 
 +Also add the following line to the ''router.db'' file: 
 +<code>sw0.gravitons.in:cisco-sb:up</code> 
 + 
 +If the device was a more //classic// Cisco device we would have used something like this in the ''.clogin'' file: 
 +<code> 
 +add method   sw0.gravitons.in  ssh 
 +add user     sw0.gravitons.in  noc 
 +add password sw0.gravitons.in  noc-password enable-password 
 +</code> 
 +And this in the ''router.db'' file: 
 +<code>sw0.gravitons.in:cisco:up</code> 
 + 
 +==== WebSVN ==== 
 + 
 +With WebSVN it will be possible to have a user-friendly view of what RANCID backups and records. 
 +<code>cd /var/www 
 +wget 'http://websvn.tigris.org/files/documents/1380/49056/websvn-2.3.3.tar.gz' 
 +tar xf websvn-2.3.3.tar.gz 
 +mv websvn-2.3.3 svn 
 +cp /var/www/svn/include/distconfig.php /var/www/svn/include/config.php 
 +chown -R www-data:www-data /var/www/svn</code> 
 + 
 +Now the following line needs to be added to the WebSVN configuration to see the repository. 
 +<code>$config->addRepository(‘RANCID Backup’, ‘file:///var/lib/rancid/SVN/’);</code> 
 + 
 +Eventually, Apache needs to be able to read the files in the SVN repository. 
 +<code>chown -R rancid:www-data /var/lib/rancid/SVN</code>
sysadmin/backups.1380493833.txt.gz · Last modified: 2021/01/04 20:41 (external edit)