So I have several hundred branch devices.. Cisco 2821's with an integrated switch module. Each device is setup the following: 10.x.x.1 (router) and 10.x.x.2 (switch). I want to update my NTP server statements on the switch to be the router IP (.1). I am trying to find a way to do this with the VTP scripting and was wondering if anybody had a better way.
My thoughts are to use a DB variable to pull the IP Address of the current device ($IPAdress) and use slice to get rid of the last octet, .2, and add .1 to it.
Here is what I am thinking:
#set( $ipadd = $IPAddress )
#set( $network = $ipadd.substr(0).slice(0, -1)
#set( $ntpserver = $network + "1" )
ntp server $ntpserver
I tried to create this template in PI, but I'm having a problem when I deploy. How would I setup the variables for this with the managed variable tab? I shouldn't have to fill in any values for the variables due to it all being set off of the DB IPAddress variable correct?
Any thoughts or input on how to make this process easier?