SaltStack - Installation


Advertisements

Before moving to installation, you need to have the following requirements −

  • A Linux server (latest Ubuntu server).

  • sudo or root access to this server.

Install all the updates using the following command −

sudo apt-get update

Install SaltMaster

Install the SaltMaster from the repository with the following apt-get command.

sudo apt-get install salt-master

Install Salt Minion

Install the Salt minion from the repository with the following apt-get command.

sudo apt-get install salt-minion 

Install Salt syndic

Install the Salt syndic from the repository with the following apt-get command.

sudo apt-get install salt-syndic

Master Configuration

Salt configuration is very simple. The default configuration for the master will work for most installations. The configuration files are installed in the ‘/etc/salt’ directory and are named after their respective components, such as − /etc/salt/master and /etc/salt/minion.

#interface: 0.0.0.0
interface: <local ip address>

After updating the configuration file, restart the Salt master using the following command.

sudo service salt-master restart

Minion Configuration

Configuring a Salt Minion is very simple. By default a Salt Minion will try to connect to the DNS name “salt”; if the Minion is able to resolve that name correctly, no configuration is required. Redefine the “master” directive in the minion configuration file, which is typically /etc/salt/minion, as shown in the code below −

#master: salt
master: <local ip address>

After updating the configuration file, restart the Salt minion using the command below.

sudo service salt-minion restart

Key Management

Salt uses AES Encryption for all the communication between the Master and the Minion. The communication between Master and Minion is authenticated through trusted, accepted keys.

salt-key -L

It will produce the following output

Accepted Keys:
Denied Keys:
Unaccepted Keys:
<local system name>
Rejected Keys:

Accept all keys by issuing the command below.

sudo salt-key -A

It will produce the following output

The following keys are going to be accepted:
Unaccepted Keys:
<local system name>
Proceed? [n/Y] y
Key for minion bala-Inspiron-N4010 accepted.

Now again issue the salt key listing command,

salt-key -L

It will produce the following output

Accepted Keys:
<local system name>
Denied Keys:
Unaccepted Keys:
Rejected Keys:

Sending Commands

The communication between the Master and a Minion must be verified by running the test.ping command.

sudo salt '*' test.ping

It will produce the following output

<local system name>
   True

Here, ‘*’ refers to all the minions. Since, we only have one minion – test.ping, it executes the ping command and returns whether the ping is successful or not.

Advertisements