Forum Discussion

Prakash_Krishn2's avatar
Prakash_Krishn2
Icon for Nimbostratus rankNimbostratus
May 28, 2019

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

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

  • 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

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