16-May-2021 07:39
Hello All,
I'm in need of F5 SDK help to delete a provided node on the LTM. I have prepared the below scripts and for some reason the sequence is not wrong.
Could you please suggest?
from f5.bigip import ManagementRoot
# Connect to the BigIP and configure the basic objects
mgmt = ManagementRoot("x.x.x.x", "x.x.x.x", "x.x.x.x")
#Enter the member name to delete
member1 = input("Enter the host_name to delete ")
#Get a collection of all members and load it
all_members = mgmt.tm.ltm.pool.members_s.get_collection()
member_delete = mgmt.ltm.pool.members_s.load(name='member1', partition='Common')
# Find for a given node and Delete a node if it exists
if mgmt.ltm.pool.members_s.exists(name='member1', partition='Common'):
member_delete.delete()
Regards,
Thiyagu
17-May-2021
10:47
- last edited on
04-Jun-2023
20:54
by
JimmyPackets
Hello Thiyagu.
This works for me:
from f5.bigip import ManagementRoot
# ----------------------------------------------------------
session = ManagementRoot("F5_mgmt_IP","username","password",token=True)
pools = session.tm.ltm.pools.get_collection()
for pool in pools:
for member in pool.members_s.get_collection():
if member.name.startswith('mynode'):
member.delete()
Regards,
Dario.