Set up a salt master and minion guide on Ubuntu 16.04


This article is part of a series I’m writing on using Saltstack.

Saltstack uses the master-slave architecture for communication and setting up Saltstack is one of the easiest configurations I’ve ever done. It involves installing the server software on the master and a client on the the slave device, known as a minion.

First, we will setup the salt-master:

  1. Fetch and run the bootstrap script:
  2. Start the salt-master process:

salt-master will now be installed and running. You will need the IP address (or domain name) of your machine for setting up the salt-minion.

Next, we will setup the salt-minion:

  1. Fetch and run the bootstrap script (note the lack of ‘-M’):
  2. Set the IP/Hostname to that of the salt-master in the salt-minion config file:
  3. Restart the salt-minion:

That is enough config to begin working with Saltstack!

To test if everything is working, log onto the salt-master and fetch a list of all keys the salt-master is aware of:

The response will show different types of keys: Accepted, Denied, Unaccepted and Rejected. In Saltstack, it is the minion that initiates communication with the master and so each new minion must be allowed to connect. If the previous steps have worked correctly, you should see an entry under the ‘Unaccepted Keys’ section. This will likely be the hostname of the minion machine. By default the salt-minion used the hostname of the machine as the minion_id.

Quickly accept all keys:

Confirm as required and then rerunning ‘salt-key -L’ should show the minion has moved from unaccepted to accepted. Once this is complete you now have control over the minion!

Test the key has ben accepted by telling the minion to run a command:

And that’s it! You now have a salt-master able to control a salt-minion.

Leave a comment

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