Forum Discussion
TMSH Script on LTM w/ Partitions
I can execute a series of TMSH commands to build a virtual server, pool, and nodes within the partition that I'm currently in.
I've built a script to take data in from the command line and build the same thing with my TMSH commands.
The issue is that we have multiple partitions on our LTMs.
When I build a script it gets saved in /CLI/SCRIPTS for whatever partition I'm in.
Can I put the script in a central depository like /CLI/SCRIPTS in the Common partition and have it execute in multiple partitions?
Intent is to have a central code depository on the LTM and to be able to have the script create virtual servers in multiple partitions. The partition setting with virtuals, pools, and nodes seems to be read-only.
How does one navigate partitions w/ TMSH scripts?
4 Replies
- tbledsoe_112342
Nimbostratus
Kept looking around and ended up doing a self rescue.
For V11, to specify the partition you want your tmsh command to execute in you need to cd to the partition within the script. I put the partition in via the command line on the script via ARGV.
set partition [ lindex $tmsh::argv 6 ]
SET PARTITION
tmsh::cd \/$partition
CREATE NODE
tmsh::create ltm node $node_ip \{ yadda yadda yadda...
------------------------------
This ends up building the node in what's definded by partition. - tbledsoe_112342
Nimbostratus
Kept looking around and ended up doing a self rescue.
For V11, to specify the partition you want your tmsh command to execute in you need to cd to the partition within the script. I put the partition in via the command line on the script via ARGV.
set partition [ lindex $tmsh::argv 6 ]
SET PARTITION
tmsh::cd \/$partition
CREATE NODE
tmsh::create ltm node $node_ip \{ yadda yadda yadda...
------------------------------
This ends up building the node in what's definded by partition. - Brent_Blood_768Historic F5 AccountYour solution of using tmsh::cd to change the working folder is fine, but you can also specify the folder path (partitions are top-level folders) explicitly as part of the object name.
I anticipate this would work as well:set partition [lindex $tmsh::argv 6] tmsh::create ltm node /$partition/$node_ip \{ yadda yadda yadda... - tbledsoe_112342
Nimbostratus
Elegant. Thanks.
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