[rancid] Re: Using Rancid to pus DST changes
Chris Moody
cmoody at qualcomm.com
Wed Mar 7 20:56:35 UTC 2007
Or, even easier.
Write the line(s) of config you want to issue on every device into a
file....I'll call it `dst-config`.
Then, issue the following:
------
./clogin -f .cloginrc -x dst-config <device>
I personally create a shell for loop:
------
ex>
for i in `cat .cloginrc | grep user | cut -f 2 `; do ./clogin -f
.cloginrc -x dst-config $i ; done
Basically, you just need to feed the first command a device name...and
clogin will handle issuing the correct command(s) for you.
Easy.
I did the same operation to some systems under my control for DST. I
had my firewalls and network gear all updated in a matter of a few minutes.
Please feel free to contact me offline if you need more help. This type
of operation is VERY easy to accomplish and really shows how much rancid
shines.
Cheers,
-Chris
Robin Mordasiewicz wrote:
> On Wed, 7 Mar 2007, Todd Heide wrote:
>
>> How can I use (if I can) rancid to push a configuration change for the DST to all the routers? Basically it is one line,
>> clock summer-time CST recurring 2 Sun Mar 2:00 1 Sun Nov 2:00
>
> One thing you can use is expect. Here is a simple example expect script
> which you can run on each router which looping through your router.db file
>
> [ myusername at localhost ]$ expect -f summertime_DST.exp myrouter.mydomain.com
>
> < summertime_DST.exp >
> #!/usr/bin/expect -f
> #
> set force_conservative 0 ;# set to 1 to force conservative mode even if
> ;# script wasn't run conservatively originally
> if {$force_conservative} {
> set send_slow {1 .1}
> proc send {ignore arg} {
> sleep .1
> exp_send -s -- $arg
> }
> }
>
> set timeout -1
> set userid "myusername"
> set vtypasswd "mypassword"
> set rtr [lindex $argv 0]
>
> spawn telnet $rtr
> match_max 100000
>
> expect {
> {Username} { send "$userid\r"
> expect {
> {*Password*} { send "$vtypasswd\r" }
> }
> }
> {telnet>} { send_user "$rtr - telnet failed\n"
> exit
> }
> {Password} { send "$vtypasswd\r" }
> }
>
>
>
> send -- "conf t\r"
> send -- "clock summer-time $DST_timezone recurring 2 Sun Mar 2:00 1 Sun Nov 2:00\r"
> send -- "wr mem\r"
> send -- "end\r"
> send -- "exit\r"
>
> expect eof
>
> < /summertime_DST.exp >
>
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
>
>
More information about the Rancid-discuss
mailing list