For daily operations we may need to run a shell command in multiple SSR routers for health checks , for restarting some services , for pre checks before upgrade etc.
To run shell commands in multiple SSR routers using asset ID, you can follow below steps.
[email protected]# show assets ========== ======= ===================================== ================= ========= ================ ======== Router Node Asset Id SSR Version Status Time in Status Errors ========== ======= ===================================== ================= ========= ================ ======== 128t-br1 node1 128t-br1.local 6.1.4-23.r2.el7 Running 27d 4h 29m 0s 0 128t-br2 node1 128t-br2 6.1.4-23.r2.el7 Running 1d 18h 4m 17s 0 128t-br3 node1 128t-br3 6.1.4-23.r2.el7 Running 25d 4h 15m 53s 0 None None 128t-6.1.4-23.r2.el7.openstacklocal None Pending 27d 4h 33m 15s 0 None 128t-br1 None Pending 27d 4h 33m 15s 0
Below is a sample command to run few shell commands to both 128t-br2 and 128t-br3
The output will be displayed as soon as execution is completed in all the router
[root@128t-6 ~]# t128-salt -L "128t-br2,128t-br3" cmd.run "date;hostname;uptime" 128t-br3: Mon Aug 12 22:38:59 UTC 2024 128t-br3 22:38:59 up 97 days, 36 min, 1 user, load average: 4.00, 4.06, 4.13 128t-br2: Mon Aug 12 22:39:00 UTC 2024 128t-br2 22:39:00 up 47 days, 20:52, 1 user, load average: 4.14, 4.32, 4.30