Discussion:
[rancid] using RANCID for mass configuration changes
Smirnoff Alexander
2008-09-16 06:29:03 UTC
Permalink
Hello!



I want to use RANCID for mass configuration changing on routers, like
set snmp or syslog server address.

What best place in RANCID scripts for this commands ?
--
Regards,
Alexandr Smirnov
+7(812)3468600 # 54682
Head of Data Transmission Networks Monitoring Service
mailto:***@gldn.net <mailto:***@gldn.net>
Daniel Medina
2008-09-16 16:32:28 UTC
Permalink
Post by Smirnoff Alexander
I want to use RANCID for mass configuration changing on routers, like
set snmp or syslog server address.
What best place in RANCID scripts for this commands ?
You could just use clogin.

As a one-liner:

$ clogin -c 'conf t; snmp-server host 1.1.1.1 public; end; wr mem' router1 router2 router3

Or put the commands in a file:

$ cat /tmp/commands
conf t
snmp-server host 1.1.1.1 public
end
wr mem

$ clogin -x /tmp/commands route1 router2 router3

Caveats apply (beware of commands which may prompt you back, for example).
--
Dan
Eric Cables
2008-09-16 17:32:35 UTC
Permalink
I wrote a very dirty script to do this a while back. I'm sure there
is something better out there, but this suits my needs.

You'll need a small framework in place for this to work, namely:
- Create a directory called "device-lists" in the rancid homedir (or
wherever you'd like, just update the script VAR)
- Create a directory called "change-scripts" in the rancid homedir
(or wherever you'd like, just update the script VAR)

Once you've done the above, simply put a file with a list of devices
(one per line) you'd like to make changes to into the device-lists
folder "syslog-changes.dl" for example, and place a file with the
changes you want to make (as you'd type them on the router) in the
change-scripts folder "syslog-changes.cs" for example.

-- Begin config-push.sh --
#!/usr/local/bin/bash
#
# The purpose of this script is to automate configuration changes to a
# large number of devices. The script identifies the device list, as well
# as the change script, and then pushes the changes one by one.
#

CLOGINPATH="/usr/home/rancid/bin/clogin"
CREDENTIALS="/usr/home/rancid/.cloginrc"
DEVICELISTPATH="/usr/home/rancid/device-lists/"
CHANGESCRIPTPATH="/usr/home/rancid/change-scripts/"
CHANGELOG="/usr/home/rancid/logs/changelog-`date +%m-%d-%Y`.log"

clear
echo "=====[ Rancid Config Push Script ]====="
echo ""
echo "Please enter the proposed device list:"
echo "`ls $DEVICELISTPATH`"
echo "--------------------------------------"
echo -n "> "
read DEVICELIST

if [ -f $DEVICELISTPATH$DEVICELIST ]
then
echo ""
echo "Device List = \"./device-lists/$DEVICELIST\" (confirmed)"
else
echo ""
echo "Device list = \"./device-lists/$DEVICELIST\" (does not exist!)"
echo "Aborting..."
echo ""
exit
fi

echo ""
echo "Please enter name of change script:"
echo "`ls $CHANGESCRIPTPATH | grep -v ".sh" | grep -v "device-lists"`"
echo "-----------------------------------"
echo -n "> "
read CHANGESCRIPT

if [ -f $CHANGESCRIPTPATH$CHANGESCRIPT ]
then
echo ""
echo "Change Script = \"./change-scripts/$CHANGESCRIPT\" (confirmed)"
echo ""
else
echo "Device list = \"./change-scripts/$CHANGESCRIPT\" (does not exist!)"
echo "Aborting..."
echo ""
exit
fi

echo "-- Proposed Changes --"
echo "`cat $CHANGESCRIPTPATH$CHANGESCRIPT`"
echo "-- Proposed Changes --"
echo ""
echo "Are you sure you want to proceed? If so, type \"yes\":"
echo -n "> "
read AREYOUSURE

if [ $AREYOUSURE != "yes" ]
then
echo ""
echo "Aborting..."
echo ""
exit
else
echo ""
echo "Implementing Changes..."
echo ""
fi

#for i in `cat $DEVICELISTPATH$DEVICELIST`
# do echo "===[ $i ]==="
# $CLOGINPATH -f $CREDENTIALS -x $CHANGESCRIPTPATH$CHANGESCRIPT $i
#done

for DEVICE in `cat $DEVICELISTPATH$DEVICELIST`
do
echo "===[ $DEVICE ]==="
echo "" >> $CHANGELOG
echo "===[ $DEVICE ]===" >> $CHANGELOG
echo "" >> $CHANGELOG
OUTPUT=`$CLOGINPATH -f $CREDENTIALS -x $CHANGESCRIPTPATH$CHANGESCRIPT $DEVICE`
echo "$OUTPUT" >> $CHANGELOG
done
-- end config-push.sh --

--
Eric Cables
Post by Daniel Medina
Post by Smirnoff Alexander
I want to use RANCID for mass configuration changing on routers, like
set snmp or syslog server address.
What best place in RANCID scripts for this commands ?
You could just use clogin.
$ clogin -c 'conf t; snmp-server host 1.1.1.1 public; end; wr mem' router1 router2 router3
$ cat /tmp/commands
conf t
snmp-server host 1.1.1.1 public
end
wr mem
$ clogin -x /tmp/commands route1 router2 router3
Caveats apply (beware of commands which may prompt you back, for example).
--
Dan
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Smirnoff Alexander
2008-09-17 06:19:39 UTC
Permalink
Thanx a lot ! ;)

-----Original Message-----
From: Daniel Medina [mailto:***@gmail.com]
Sent: Tuesday, September 16, 2008 8:32 PM
To: Smirnoff Alexander
Cc: rancid-***@shrubbery.net
Subject: Re: [rancid] using RANCID for mass configuration changes
Post by Smirnoff Alexander
I want to use RANCID for mass configuration changing on routers, like
set snmp or syslog server address.
What best place in RANCID scripts for this commands ?
You could just use clogin.

As a one-liner:

$ clogin -c 'conf t; snmp-server host 1.1.1.1 public; end; wr mem'
router1 router2 router3

Or put the commands in a file:

$ cat /tmp/commands
conf t
snmp-server host 1.1.1.1 public
end
wr mem

$ clogin -x /tmp/commands route1 router2 router3

Caveats apply (beware of commands which may prompt you back, for
example).
--
Dan
Peter Serwe
2008-11-08 00:48:02 UTC
Permalink
Wow.. I must say that script is far less dirty than the script I did
which just has me set the group (rancid-group)
of routers, and then push changes out via command files tailored to
the group of routers (group actually being
roughly equivalent to manufacturer and type).

I used the script to quickly demo that functionality at a presentation
I gave on RANCID last night..

Peter

On Tue, Sep 16, 2008 at 10:19 PM, Smirnoff Alexander
Post by Smirnoff Alexander
Thanx a lot ! ;)
-----Original Message-----
Sent: Tuesday, September 16, 2008 8:32 PM
To: Smirnoff Alexander
Subject: Re: [rancid] using RANCID for mass configuration changes
Post by Smirnoff Alexander
I want to use RANCID for mass configuration changing on routers, like
set snmp or syslog server address.
What best place in RANCID scripts for this commands ?
You could just use clogin.
$ clogin -c 'conf t; snmp-server host 1.1.1.1 public; end; wr mem'
router1 router2 router3
$ cat /tmp/commands
conf t
snmp-server host 1.1.1.1 public
end
wr mem
$ clogin -x /tmp/commands route1 router2 router3
Caveats apply (beware of commands which may prompt you back, for example).
--
Dan
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
--
$B%T!<%?!<(B
A***@HydroOne.com
2008-09-16 18:12:41 UTC
Permalink
Are 'Rugged' routers and switched supported?



I have this list as supported vendors are there others as well?



1. Alteon WebOS
2. Bay Networks (Nortel)
3. Cisco
4. ADC EZT3
5. Foundry
6. HP
7. Hitachi router
8. Juniper
9. Netscaler
10. Riverstone



Thanks
Lance Vermilion
2008-09-16 18:30:14 UTC
Permalink
Atif,

Is the CLI similar to any of those listed? If it is it might just
work. if not you can easily write your own if you have some basic
programming experience.

-lance
Post by A***@HydroOne.com
Are 'Rugged' routers and switched supported?
I have this list as supported vendors are there others as well?
Alteon WebOS
Bay Networks (Nortel)
Cisco
ADC EZT3
Foundry
HP
Hitachi router
Juniper
Netscaler
Riverstone
Thanks
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
A***@HydroOne.com
2008-09-17 13:16:21 UTC
Permalink
How would we collect information like

* IOS, Junos versions running on network devices,

* HW: Linecards on GSR's; modules on routers



Can we get this info from CVS repository?



Thanks
Lance Vermilion
2008-09-17 17:20:05 UTC
Permalink
A lot of this type of info is already captured. Look at the
commandtable in the rancid file. It will show all the commands that
are run. Rancid also collects snmp ifindex info and some other stuff
too.
Post by A***@HydroOne.com
How would we collect information like
· IOS, Junos versions running on network devices,
· HW: Linecards on GSR's; modules on routers
Can we get this info from CVS repository?
Thanks
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Loading...