Table of Contents
Management of the geolcation database files can sometimes be diffficult as they are not by default included in UCS files (althoguht they can). At times there is a need for automating the installation of said files and this is an examnple of how to do so.
Here's why:
- The Geolocation db files are very large, and while they can be put into a UCS it may be prohibitive to do so
- If you have an RMA or other activity that requires a quick turn around, you don't have time for update processes
- You have an automation or CI/CD system established but you need to include the geolocation dbs
Code will be in python3, perhaps other languages in the future.
This is very simple example code, not a lot to be prepared for.
To use this example, you will need:
- Licensed big-ip system (14.1 or greater, but some earlier versions may work)
- Admin access to the big-ip system. This will use REST interfaces and you will need to get authenticated
- Host system with a python 3.8 enviroment requests & json libraries. Note, you could use an earlier version of Python3 but you will need to remove the := operator
No installation necessary
Arguments:
- hostname/ip
- credentials in the form of username:password
- location of geolocation zip file
- location of geolocation md5 file Note: You CAN omit the password and then place the password in the env variable BIGIP_PASS
The script will:
- Gets auth token
- Verifies the token
- Backs up the existing database
- Uploads the md5 and zip file
- Checks the md5 sum
- Unzips the md5
- Walks through each rpm and installs it
- Verifies each .dat link directly
- Cleans up the rpm files
- Cleans up the .zip and .md5 file
- Deletes the backup directory
Example:
geolocation-update.py 10.1.1.151 admin:admin ip-geolocation-v2-2.0.0-20220228.573.0.zip ip-geolocation-v2-2.0.0-20220228.573.0.zip.md5
Getting access token
Backing up existing db
Uploading geolocation updates
Installing geolocation updates
Starting GeoIP Version: 20210412
Ending GeoIP Version: 20220228
GeoIP DB updated!
Distributed AS-IS with no guarantee implied or otherwise
Reference:
- https://support.f5.com/csp/article/K11176
- https://code.visualstudio.com/docs/python/python-tutorial
- https://github.com/mhermsdorferf5/bigip-geodb-update
Acknowledgements
- Mark Hermsdorfer for his help and suggestions and how he approached this effort.
- Mark Menger for his continued council, guidance, and expertise