Creating a tmsh script with iControl REST and using it to restart HTTPD
The only thing with such scripts is how to see the real output when using API:
curl -sku admin:niki@111 https://10.1.1.130/mgmt/tm/cli/script/niki -H "Content-Type: application/json"
Output API:
{"kind":"tm:cli:script:scriptstate","name":"niki","fullPath":"niki","generation":7832,"selfLink":"https://localhost/mgmt/tm/cli/script/niki?ver=16.1.3.2","apiAnonymous":"proc script::init {} {\n}\n\nproc script::run {} {\nreturn [tmsh::list ltm pool]\n}\n\nproc script::help {} {\n}\n\nproc script::tabc {} {\n}\n","ignoreVerification":"false","totalSigningStatus":"not-all-signed","verificationStatus":"none"}
Output CLI:
root@(bigip2)(cfg-sync Standalone)(Active)(/Common)(tmos)# run cli script niki
ltm pool Fake-ICAP-pool {
members {
1.1.1.1:icap {
address 1.1.1.1
}
}
Script:
root@(bigip2)(cfg-sync Standalone)(Active)(/Common)(tmos)# edit cli script niki
modify script niki {
proc script::init {} {
}
proc script::run {} {
puts [tmsh::list ltm pool]
}
proc script::help {} {
}
proc script::tabc {} {
}