Create LTM Virtuals
Problem this snippet solves:
This example shows how to automate virtual server creation with tmsh scripting.
How to use this snippet:
Note: This was used in conjunction with a simple iRule just to create HTTP responders for another LTM system. The iRule is very simple:
when HTTP_REQUEST { HTTP::respond 200 content "[IP::local_addr]" }
Code :
cli script create_virtuals.tcl { proc script::run {} { if { $tmsh::argc < 4 } { puts "Requires three arguments:" exit } else { set start [lindex $tmsh::argv 1] set total [lindex $tmsh::argv 2] set rulename [lindex $tmsh::argv 3] } scan $start "%d.%d.%d.%d:%d" a b c d p for {set x 0} {$x < $total} {incr x} { tmsh::create ltm virtual testvip_$x destination $a.$b.$c.$d:$p profiles add \{http\} rules \{$rulename\} incr d if { $d > 255 } { set d 0 incr c if { $c > 255 } { set c 0 incr b if { $b > 255 } { set b 0 incr a } } } } } proc script::help {} { tmsh::add_help "Create contiguous block of virtual servers as HTTP responders\n\ " } }
Published Mar 10, 2015
Version 1.0CodeCentral_194
Cirrus
Joined May 05, 2019
CodeCentral_194
Cirrus
Joined May 05, 2019
No CommentsBe the first to comment