F5 LTM HA pair upgrade Automation using Python

Code is community submitted, community supported, and recognized as ‘Use At Your Own Risk’.

Short Description

Perform autonomous F5 LTM upgrades with python

Using a single python script to Automate F5 LTM's deployed as a High Available Pair

Problem solved by this Code Snippet


  • the script gathers ucs and qkview from both the device pairs and uploads to an SFTP server defind by environment variables
  • it then gathers the state of all the VIPs and Pools from both device pairs and stores the files locally
  • It stores the state of the active volumes from both devices
  • it identifies the active device and saves the running config and does a verify load to check for config errors
  • it then proceeds to find the standby device and install the image on a inactive volume
  • once installation of image is complete it proceeds to reboot to volume with new image
  • once the device is up and the mcpd is up, it checks the state of vips/pools with the pre-check, if there are differences it stops the upgrade, if no differences are identified it proceeds with the next device


How to use this Code Snippet

git clone https://github.com/anesh/f5_ltm_upgrade.git
cd f5_ltm_upgrade
  • create a file called "f5devices.txt" and add the devices to be upgarded along with image in the below format
F5-2-lab BIGIP-15.1.6-0.0.8.iso
F5-1-lab BIGIP-15.1.6-0.0.8.iso
  • To run the automation exceute the below command
python start_upgrade.py

Full Code Snippet


Published Sep 02, 2022
Version 1.0

Was this article helpful?

No CommentsBe the first to comment