Forum Discussion
- IheartF5_45022Nacreous
Yes you can do that. I've done it before using an external datagroup, and storing the datagroup contents on an external HTTP (or HTTPS) server. Here's the tmsh command;-
tmsh modify /sys file data-group /Common/dg_ip_blacklist separator ":=" source-path http://10.2.3.4:8080/etc/ip_blacklist.txt
That doesn't quite get you there though...use the following guide https://devcentral.f5.com/d/icontrol-rest-user-guide-version-1150 to convert the tmsh command into a REST request that can be sent by a remote server....
- Ben_9010Nimbostratus
Thanks for replying.
 
I found the data-group function in the iControlREST documentation, but I didn't see anything about tables.
 
https://devcentral.f5.com/s/articles/the101-irules-101-datagroups-amp-tables
 
- IheartF5_45022Nacreous
OK ok
curl -k -u admin:'blah' -H "Content-Type: application/json" -X PUT -d '{"name":"dg_ip_blacklist","partition":"/Common","source-path": "http://10.2.3.4:8080/etc/ip_blacklist.txt"}' https://10.191.58.180/mgmt/tm/sys/file/data-group/dg_ip_blacklist/?$filter=partition%20eq%20Common
- IheartF5_45022Nacreous
If you'd rather manipulate data group entries individually you can use an internal datagroup and you should be able to use iControl REST to do that too.
Hi Ben,
you can't change
data via REST. But you can add/remove data-group entries via REST and then access the data-group via iRules.[table]
To add/remove entries via REST into/from a data-group without applying the entire data-group again, you can deploy some TMSH helper scripts on your box and call those scripts via REST while passing the required parameters.
To get an idea how this could be implemented, you may take a look to the post below. It explains how a data-group can be changed within an iRule by using a combo of iRule->SIDEBAND Connection->REST API->TMSH Script->Data-Group. Simply skip the iRule->SIDEBAND part and you should have a working solution within minutes...
https://devcentral.f5.com/questions/write-into-internal-data-group-from-irule-50597
Cheers, Kai