Forum Discussion
stupid48
Altocumulus
Mar 24, 2016Update an irule remotely?
Hi there,
I'm trying to automate the procedure of updating an irule. We have a single iRule that does a bunch of redirects based on URI and this list changes periodically. Is there a will to u...
JRahm
Admin
Mar 24, 2016yes, you can make an update via iControl. In fact, the iRule editor uses icontrol (SOAP interface) to make these changes, but you can use the REST interface as well by issuing a PUT. Here's a REST example I wrote in python a while back:
import requests, json
def modify_rule(bigip, name, code):
payload = {}
payload['apiAnonymous'] = code
bigip.put('%s/ltm/rule/%s' % (b_url_base, name), data=json.dumps(payload))
print 'Modifying rule...'
mycode = 'proc sequence {from to} {\n\tfor {set lst {}} {$from <=$to} {incr from} {\n\t\tlappend lst $from\n\t}\n\treturn $lst\n}'
b = requests.session()
b.auth = ('admin', 'admin')
b.verify = False
b.headers.update({'Content-Type' : 'application/json'})
b_url_base = 'https://172.16.44.15/mgmt/tm'
modify_rule(b, 'ruleProcLib', mycode)Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects