If you have a handful of servers you need to add to Saltstack for management purposes, and don’t want to spend 10 minutes per node setting it up the Saltstack minion, you normally do one of two things. One, create a script to automate the process for you or Two, streamline the process to a single command. Well I did the latter, and felt like sharing it so you don’t have to spend 5 minutes dealing with regular expressions and sed.
Note: This is made to be used on Debian Wheezy, and needs to be ran as root.
echo "deb http://debian.saltstack.com/debian wheezy-saltstack main" > /etc/apt/sources.list.d/saltstack.list && wget -q -O- "http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key" | apt-key add - && apt-get update && apt-get -y install salt-minion && sed -i 's/#master: salt$/master: 111.222.333.444/' /etc/salt/minion && service salt-minion restart
The string of commands above will add the saltstack repo, update the package database, install salt-minion and all of the dependencies, set the saltstack daemon to use the IP of 111.222.333.444 as the master server, and then restart the saltstack minion service. Once the command is complete, you can finish adding the system by running salt-key -A on the saltstack master server. Remember to change the IP in the command to the hostname or IP of your master server first otherwise it will not be able to communicate with it properly.