Forum Discussion
Running tmsh commands on multiple devices at once
Hey DevCentral,
I was hoping BIG-IQ CM would make this a little easier to do but that isn't the case. I need to run the same tmsh commands on multiple devices at once, instead of taking hours to do them one by one. This is something I've never attempted, as it is a new concept for me.
Does anyone have any ideas as to how to do that?
- Shaun_Simmons1Altostratus
Prerequisite: You will need a box that can ssh to all of your devices. "Pivot box" or "Jump box"
--Using CLI via F5 box or *Nix box
Shown below on a Version 9 box: Show me: hostname and kernel version and BIGIP version
&& - Will execute the command whether the previous command completed successfully.
while read HOST ; do echo "" | ssh $HOST "uname -a && date && echo -en '\n' && b version show | head -6 | sed 's/Final*//'" ; done < f5hosts.txt
f5hosts.txt --a list of all of the boxes you want to run tmsh commands, by hostname or IP
in between the quotes you list out the tmos commands. ie. "tmostcommand && tmostcommand && tmoscommand"
while read HOST ; do echo "" | ssh $HOST "tmostcommand && tmostcommand && tmoscommand" ; done < f5hosts.txt
Example:
while read HOST ; do echo "" | ssh $HOST "tmsh show ltm persistence persist-records && tmsh show ltm nat all && show sys hardware " ; done < f5hosts.txt
If you prefer you can pipe everything out to a file.
> output.txtwhile read HOST ; do echo "" | ssh $HOST "tmsh show ltm persistence persist-records && tmsh show ltm nat all && show sys hardware " ; done < f5hosts.txt
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