but for the life of me I can not figure out the payload to remove an irule. I am 2 hours into testing and research and I am stumped. Any ideas would be appreciated.
import requests
from f5.bigip import ManagementRoot
requests.packages.urllib3.disable_warnings()
connect to your F5
b = ManagementRoot('your_f5_mgmt_ip', 'user', 'pass')
load the rule
rule1 = b.tm.ltm.rules.rule.load(name='irule_delete', partition='Common')
Delete the Rule
rule1.delete()
Thank you for the response. We are trying to keep these as API calls back to the F5. Also, the proposed solution would work to delete an irule but it would not work to remove an assigned irule from a VIP.
Ok, you want to remove the irule from the virtual server. Here is how you can do that:
import requests
from f5.bigip import ManagementRoot
requests.packages.urllib3.disable_warnings()
connect to your F5
b = ManagementRoot('your_f5_mgmt_ip', 'user', 'pass')
load the virtual server
vip = b.tm.ltm.virtuals.virtual.load(name='vs_name')
list irules in vs
vip.rules
[u'/Common/irule1', u'/Common/irule2']
In this case we'll remove the irule2. The irule1 will remain in the virtual server
vip.rules = ['/Common/irule1']
update the configuration
vip.update()