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

F5 SDK help to delete a provided node on the LTM

Thiyagu
Cirrus
Cirrus

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

1 REPLY 1

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.

Regards,
Dario.