|Think about Loose Coupling|
Compare and apply differences on configuration fileby cord-bin (Friar)
|on May 06, 2014 at 08:49 UTC||Need Help??|
cord-bin has asked for the
wisdom of the Perl Monks concerning the following question:
Hi I need to create a script to update a cisco ASA firewall in a backup site. During the day admins modify the configuration on the main site and I need to update de backup site. So I should be able to take the configuration file from the main site, parse it, change the IP's and apply the differences to the backup site. The backup site is a copy of the main site but has different IP address namespace. The thing is that ASA has 3 kinds of settings:
where I have to change the IP address that I need to map it so 172.20.20.125 became 184.108.40.206
where there is a space in front of every statement and I have to change again de IP
where IP address has to change according to the backup site
Which would be the best way to treat this entries to compare the configuration from one site to the other and get the differences that has to be modified before being applied on the second site?
I can't just compare two files line by line, I need to compare in a way by block or something I can't get up with now and I kindly ask your enlightenment.