recently, the company added 40 servers for the last active function, although the server can be managed by saltstack (automated operations Tools Saltstack), the project can be released through Jenkins + Saltstack (using jenkins+ Saltstack+sh deploy the project to multiple servers, but before this need to get rid of the 40 server Saltstack configuration file Ah, can not be a server manually to deal with it (well, before you write this article on a half-day, really manual to modify, pit AH)
Because the public key has been added so that you can login without password directly
#!/bin/shIP=$1ssh"sed-i ' s/id:shop02/id:active30/g '/etc/salt/ Minion && Service salt-minion restart"
The script is basically
1. Log in to ${ip} on this server.
2. Replace the string id:shop02 in the/etc/salt/minion file with the Id:active30
3. Restart the Salt-minion service
Of course the feeling is not very good in this way, using the Python fabric module to handle the larger point.
Use shell scripts to telnet to the server and modify the Saltstack configuration and restart the service