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

Need iControl Rest API to manage irules/LX Workspace/LX Plugins

Prakash_Krishn2
Nimbostratus
Nimbostratus

Hi all,

currently we are using F5 device model : BIG-IP-2200, We want to know the API url for below list of functions

 

Create Irule Path : Local Traffic -> Irules -> IruleList

Add Irule to Workspace Path : Local Traffic -> Irules -> LX Workspace

Add Extension to Workspace Path : Local Traffic -> Irules -> LX Plugins

 

could anyone let us know.

 

Thanks in advance.

4 REPLIES 4

Lee_Sutcliffe
Nacreous
Nacreous

Prakash_Krishn2
Nimbostratus
Nimbostratus

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

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).