Technical Forum
Ask questions. Discover Answers.
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

How to update multiple the persistence profile of multiple virtual servers?


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!


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='', username='root', password='mypasswd')
>>> box1.hostname
>>> box1.username
>>> box1.password

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:


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.


Good luck.

Thanks Rodrigo, this looks very promising however I have to admit that I have 0 knowledge of python.