Salt Master-Minion with Ubuntu 14.04 LTS – Control Your Slaves over the Internet

Would you like to control many computers (slaves, minions) from one master computer?

Salt-minions connect to master to retrieve instructions. Slaves then configure themselves to the target state: they install software, make settings and start daemons.

Following this article requires fluency in Linux command line interface, basics of TCP/IP, sudo and apt.

This article talks about two computers, master and minion (slave). The prompt shows you which computer you are on. For example, a line ‘minion$ ls’ tells you to run command ‘ls’ on the minion computer. Obviously, you don’t type the prompt.

Only master needs a public IP address and two ports open. Slaves can be behind a firewall or NAT.

Master Setup

Install latest version of salt to both master and minion. ‘salt-call –version’ should be at least Beryllium. The version shipped with Ubuntu 14.04 LTS is too old.

master$ sudo apt-get -y install salt-master

Find out master address. Use the public address, not localhost.

master$ ifconfig

Minion Setup

minion$ sudo apt-get -y install salt-minion
minion$ sudoedit /etc/salt/minion

The file needs only one line. By default, it contains only comments. Use the master IP address you found out with ‘ifconfig’ on master. Alternatively, you can use your master’s DNS name.

## /etc/salt/minion

Make the salt-minion daemon use the configuration by restaring it. After that, the minion-daemon automatically connects to master.

minion$ sudo service salt-minion restart

Accept Minion Key

master$ sudo salt-key

Use the actual name of the minion when accepting the key

master$ sudo salt-key -a minion

Test Connection

master$ sudo salt '*'

Got “True”? Well done, you now have your very own minion waiting for your instructions.

First State (optional)

Let’s enjoy the new master-slave configuration by writing our first state. States describe the target state of our system. State configuration is idempotent – salt only makes changes if needed.

master$ sudoedit /srv/salt/moitero.sls
File.managed("/tmp/moitero.txt", contents="Hello Tero")

Command all minions to use this state.

master$ sudo salt '*' state.sls moitero

Check on the minion that your wishes have been fulfilled:

minion$ cat /tmp/moitero.txt
Hello Tero

Congratulations, you have distributed your first module to your minions. What will you configure next?

Posted in Uncategorized | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Picks

  • Boxing Clock for AndroidOcton8 Diving T-ShirtsShaking Tower Panda Android GameLearn Chinese with Android
  • Student projects