Forum Discussion
TMSH Transactions via Plink
I am trying to automate the creation of some objects via TMSH using Powershell and Plink, I would also like to utilize transactions.
The commands I'm trying to execute are the following:
- create /cli transaction
- create /gtm pool TEST_DOMAIN_POOL members add {LTM1:TEST-VS-443 LTM2:TEST-VS-443} load-balancing-mode topology alternate-mode global-availability fallback-mode none
- create /gtm wideip test-domain.ilb.domain.local pools add {TEST_DOMAIN_POOL}
- submit /cli transaction
Interactively via Putty, this works great. It falls apart when I attempt to use Plink. I get the following error:
Batch mode transactions are only available in interactive mode
I have tried connecting to the appliance via 'advanced shell' and 'tmsh' console access. It just doesn't want to work.
Is there anyway I can pass it all on one line via Bash? Or is there some other way to utilize transactions that I'm unable to find?
Unfortunately I'm stuck on 11.3 for the moment, so I am unable to use the REST API; although I thought it was still TMSH on the backend, so shouldn't it be possible?
1 Reply
- Kevin_Stewart
Employee
You're best bet will probably be to use TMSH scripts:
https://devcentral.f5.com/wiki/TMSH.Commands.ashx
So a basic example might look like this:
tmsh create cli script transact-scriptwhich creates and opens the script for editing:
create script transact-script { proc script::init {} { } proc script::run {} { tmsh::begin_transaction tmsh::create ltm pool [lindex $tmsh::argv 1] members replace-all-with \{ [lindex $tmsh::argv 2] \} tmsh::commit_transaction } proc script::help {} { } proc script::tabc {} { } }And then you can then remotely execute this script (with command arguments):
ssh root@bigip 'tmsh run cli script transact-script foobar-pool 10.10.10.10:80'Where [lindex $tmsh::argv 1] and [lindex $tmsh::argv 2] consume the command line arguments "foobar-pool" and "10.10.10.10:80" respectively.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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