Forum Discussion
4 Replies
- Lee_SutcliffeNacreous
Take a look at CloudDocs, this is where you'll find all the current API documentation.
iRules
https://clouddocs.f5.com/api/icontrol-rest/APIRef_tm_ltm_rule.html
iLX Workspace
https://clouddocs.f5.com/api/icontrol-rest/APIRef_tm_ilx_workspace.html
iLX Plugin
https://clouddocs.f5.com/api/icontrol-rest/APIRef_tm_ilx_plugin.html
There is also a good Article written by Satoshi
https://devcentral.f5.com/s/articles/creating-irules-lx-via-icontrol-rest-33119
- Prakash_Krishn2Nimbostratus
Thanks for sharing the document. We were able to create irule successfully but unable to add a new irule to existing work space the given document says about uploading .js and tcl file in existing irule or extensuion. Do you know procedure to add a new irule or extension
- Lee_SutcliffeNacreous
You need to create the file manually first, then overwrite the file, it's all documented in 's article. There are three steps needed to add a new iRule
- Create the template file
- Upload your new iRule
- Overwrite the template file with new iRule using the mgmt/tm/util/bash endpoint
Reference:
https://devcentral.f5.com/s/articles/creating-irules-lx-via-icontrol-rest-33119
Here is an excerpt from my Ansible uri-module based approach to create LTM iRules.
(I dont know if it can be used for iRule/LX as well. Sorry for hijacking this thread.)
The iRules are stored as separate files in a sub-directory on the Ansible host.
Now there is a 1st task to create "empty" iRules first and a 2nd one to actually push the files contents to the newly added iRules:
- name: block of tasks to create iRules block: - name: create empty iRules uri: validate_certs: no url: https://{{ inventory_hostname }}/mgmt/tm/ltm/rule method: POST headers: X-F5-Auth-Token: "{{ device_info[inventory_hostname].token }}" X-F5-REST-Coordination-Id: "{{ transaction_data.json.transId }}" body_format: json body: name: "{{ item.name }}" with_items: "{{ hostvars[inventory_hostname].irules }}" when: item.name not in irule_list - name: push TCL code into empty iRules uri: validate_certs: no url: https://{{ inventory_hostname }}/mgmt/tm/ltm/rule/{{ item.name }} method: PATCH headers: X-F5-Auth-Token: "{{ device_info[inventory_hostname].token }}" X-F5-REST-Coordination-Id: "{{ transaction_data.json.transId }}" body_format: json body: apiAnonymous: "{{ lookup('file', '~/irules/%s.tcl' | format(item.name)) }}" with_items: "{{ hostvars[inventory_hostname].irules }}" when: item.name not in irule_list when: irule_dict is defined
The code above is just an exerpt from a transaction based approach to get the job done.
It requires the aquisition of an auth token in advance and specific inventories.
But it hopefully illustrates the concept (method, path, content).