Forum Discussion

tbledsoe_112342's avatar
tbledsoe_112342
Icon for Nimbostratus rankNimbostratus
May 16, 2013

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

  • 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.

     

     

  • 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_768's avatar
    Brent_Blood_768
    Historic F5 Account
    Your 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...