SaltStack on CentOS 6.x

Had a play with SaltStack today, it’s a good way to manage multiple machines from a central location. It runs as a Server (master) and client (minion).

First we need to install the Salt-Master, this assumes you are installing on CentOS and don’t mind having EPEL installed on both the master and minion ….

# Install EPEL and Update on both the master and minions<br>yum update -y<br>yum install <a href="http://ftp.linux.ncsu.edu/pub/epel/6/i386/epel-release-6-8.noarch.rpm" target="_blank" data-href="http://ftp.linux.ncsu.edu/pub/epel/6/i386/epel-release-6-8.noarch.rpm">http://ftp.linux.ncsu.edu/pub/epel/6/i386/epel-release-6-8.noarch.rpm</a>

# Install the salt-master<br>yum install salt-master<br>chkconfig salt-master on<br>sed -i ‘s/#interface:’ /etc/salt/master<br>service salt-master start

# Install the salt-minion<br># Replace $salt-master.yourdomain.com with the FQDN of your salt-master

yum install salt-minion<br>chkconfig salt-minion on<br>sed -i ‘s/#master: salt/master: manager.yourdomain.com/g’ /etc/salt/minion<br>service salt-minion start

Now we have a minion talking to the master we need to accept the certificate;

salt-key -L<br>salt-key -A [hostname]

Thats it, you can now run commands across all your machines e.g.

salt ‘*’ test.ping<br>salt ‘*’ grains.ls<br>salt ‘*’ grains.items<br>salt ‘*’ cmd.has_exec service<br>salt ‘*’ cmd.run “service nginx stop”<br>salt ‘*’ cmd.run “service nginx start”<br>salt ‘*’ cmd.run “yum update -y”

For further reading RTFM.


Russ McKendrick

Buys way too many vinyl records, writes a lot about Docker & loves orchestration. Works at @node4ltd / @n4stack has written for @PacktPublishing

Read More