21-Dec-2021 07:28
I am curious if there was a way to modify VIPs w/o specifically defining them within the command .. for example :
modify ltm virtual Test-Donkey-HTTPS profiles delete { tcp-600 } profiles add { tcp }
modify ltm virtual Prod-Donkey-HTTPS profiles delete { tcp-600 } profiles add { tcp }
modify ltm virtual Stage-Donkey-HTTPS profiles delete { tcp-600 } profiles add { tcp }
So above, I would like to replace all "Donkey" VIPs in one shot to adjust their profiles.
Thank you!
21-Dec-2021
23:45
- last edited on
04-Jun-2023
19:14
by
JimmyPackets
Hi
The modify command does not accept the wildcard method. The list command does,
tmsh list ltm virtual *-Donkey-HTTPS profiles
But you can still do it this way,
tmsh modify ltm virtual Test-Donkey-HTTPS Prod-Donkey-HTTPS Stage-Donkey-HTTPS profiles delete { tcp-600 } profiles add { tcp }
If the list is huge and you want to do with wildcard, you can do it by passing 1 commands output to another,
1st command: You list all virtuals using wildcard and xargs so you have each virtual space separated.
tmsh list ltm virtual *Donkey-HTTPS one-line | awk '{print $3}' | xargs
The output would be,
Test-Donkey-HTTPS Prod-Donkey-HTTPS Stage-Donkey-HTTPS
Then you use your modify command on this, so the final command would be,
tmsh modify ltm virtual `tmsh list ltm virtual *Donkey-HTTPS one-line | awk '{print $3}' | xargs` profiles delete { tcp-600 } profiles add { tcp }
Note: Be mindful on how you form your regex, do list the virtuals first and then run the modify command while using wildcard.
Hope this helps.