Forum Discussion
Modify VS profiles using TMSH
Here are a whole bunch that you may use (with extreme caution of coarse because lazy_sysadmin & be especially cautious on systems that use non-http virtual servers like ldap):
Lists the names of the virtual servers with the basic tcp profile assigned:
tmsh list ltm virtual one-line | grep "profiles.*\ tcp\ " | awk '{ print $3 }'
Changes the individual virtual server’s profile manually (edit VIRTUAL_SERVER_NAME to whichever one you want to edit):
tmsh mod ltm virtual $VIRTUAL_SERVER_NAME profiles add { tcp-wan-optimized { context all } } profiles delete { tcp }
This is ugly but performs the previous two steps on all virtual servers that need the change made:
tmsh list ltm virtual one-line | grep "profiles.*\ tcp\ " | awk '{ print $3 }' | xargs -I vs_name tmsh mod ltm virtual vs_name profiles add { tcp-wan-optimized { context all } } profiles delete { tcp }
Lists the virtual servers with only simple http compression applied:
tmsh list ltm virtual one-line | grep "profiles.*\ httpcompression\ " | awk '{ print $3 }'
manually change individual virtual server (edit variable):
tmsh mod ltm virtual $VIRTUAL_SERVER_NAME profiles add { wan-optimized-compression { context all } } profiles delete { httpcompression }
Again, super ugly but does the job. Move all to wan-optimized-compression:
tmsh list ltm virtual one-line | grep "profiles.*\ httpcompression\ " | awk '{ print $3 }' | xargs -I vs_name tmsh mod ltm virtual vs_name profiles add { wan-optimized-compression { context all } } profiles delete { httpcompression }
Wait a sec, which ones do not have the wan-optimized-compression profile enabled?
tmsh list ltm virtual one-line | grep -v " wan-optimized-compression\ "
Apply this to all of them:
tmsh list ltm virtual one-line | grep -v " wan-optimized-compression\ " | grep virtual | awk '{ print $3 }' | xargs -I vs_name tmsh mod ltm virtual vs_name profiles add { wan-optimized-compression { context all } }
- Root44_196087Sep 16, 2015
Nimbostratus
It looks good. Can you tell me the command if I want to add tcp-lan-optimized and tcp-wan-optimized to my_virtual? So far I figured out it will be like this but not sure about its sequence and what to add in it. (I even tried tmsh ref guide but didn't get anything there) (In the VS configuration default profile is tcp) modify ltm virtual my_virtual profiles add { tcp-lan-optimized tcp-wan-optimized } ..
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