Forum Discussion
Need iControl Rest API to manage irules/LX Workspace/LX Plugins
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 definedThe 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).
Recent Discussions
Related Content
* 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
