I need to update hundreds of virtual servers from the default cookie persistence to an encrypted cookie profile. This multiplied to several bigips as well. Is there a script to do this instead of going through each end every VS and changing them one by one?
Thanks in advance!
16-Feb-2021 03:22 - last edited on 22-Nov-2022 15:12 by JimmyPackets
I'd recommend an external Python using Python SDK:
pip install f5-sdk
Then to start your script the first thing is to import the pip module you've just installed with above command:
# Import the F5 module from f5.bigip import ManagementRoot
Now, to define the variables, you can use dataclasses like this:
>>> from dataclasses import dataclass >>> @dataclass ... class f5_box: ... hostname: str ... username: str ... password: str ... ... >>> box1 = f5_box(hostname='example1.com', username='root', password='mypasswd') >>> box1.hostname 'example1.com' >>> box1.username 'root' >>> box1.password 'mypasswd' >>>
So in your code, you can access each box and "inside" of each object, you'll find username, hostname and password and you can iterate through each of the boxes and perform the changes you want.
Here's a sample of the code for you to get comfortable with: https://lessonsintech.wordpress.com/2018/06/26/f5-python-sdk-basics/
Unfortunately, I don't have a BIG-IP to test here, otherwise I'd be happy to come up with such a script for you.
Thanks Rodrigo, this looks very promising however I have to admit that I have 0 knowledge of python.