Installing and configuring Salt Master and Salt Minions on Ubuntu 18.04

Instructions for setting up interaction between Salt Master and Salt Minions on running the 18.04 operating system.

What is?

Salt is an open resource facilities monitoring platform built on a vibrant interaction bus. Salt can be made use of to take care of configuration for any set of systems or applications, to adjust information, to run commands remotely, and more.

Salt Network Architecture

The two major components that Salt includes are one Salt Master and a number of Salt Minions:

Salt Master is the main control system utilized to send commands and setups to Salt Minion (nodes).

Salt Minions (Nodes, Minions) are systems that run on taken care of servers and also receive commands and arrangements from the master.

A minimum of 2 digital servers are needed to set up communication, one for the master and also one for the host. All nodes are set up similarly.

Salt installation

The following steps must be performed on both the Master server and managed nodes.

First you need to import the repository key:

wget -O -
https://repo.saltstack.com/py3/ubuntu/18.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -

Then you need to add the repository with the following command:

echo "deb http://repo.saltstack.com/py3/ubuntu/18.04/amd64/latest bionic main" | sudo tee /etc/apt/sources.list.d/saltstack.list

Update the list of system packages:

sudo apt update

Install Salt packages, for Master:

sudo apt -y install salt-api salt-cloud salt-master salt- salt-syndic

for minions:

sudo apt -y install salt-minion

Open the following ports so that the components can communicate over the network:

sudo ufw allow proto tcp from any to any port 4505,4506

Salt Master setup

Using a text editor such as vi, open the /etc/salt/master file:

vi /etc/salt/master

Find the directive:

#interface: 0.0.0.0

Uncomment the found line and replace 0.0.0.0 with the server IP address:

interface: 121.122.121.122

After making changes, restart the service:

/etc/init.d/salt-master restart

Display the master key required to connect managed nodes by running the following command:

salt-key -F master

Expected output:

Local Keys: 
master.pem: c2:2b:2f:5f:91:f2:c3:8b:99:35:50:f9:eb:3f:5b:d7:e4:8d:c1:a2:50:9a :04:f9:e9:75:1b:3a:13:b3:24:0e 
master.pub: 10:e1:34:61:07:03:ba:aa:c2:56:61:ba:bb: 1c:af:34:55:e9:a4:66:a1:35:73:00:17:9f:2f:98:d7:71:f3:09

Copy the contents of the master.pub line directly from the console.

Salt Minion Setup

By default, Salt Minion tries to connect to the name “salt”. Using a text editor such as vi, open the /etc/hosts file:

vi /etc/hosts

Specify Master Salt’s IP address and salt name, like this:

121.122.121.122 salt

Set an ID for your node by opening the file:

vi /etc/salt/minion_id

And insert any convenient and understandable name without spaces, :

ubuntu-sys

Open the node configuration file:

vi /etc/salt/minion

Find the master_finger directive and paste the copied master.pub key as shown in the example:

master_finger: '10:e1:34:61:07:03:ba:aa:c2:56:61:ba:bb:1c:af:34:55:e9:a4:66:a1:35:73:00:17:9f:2f:98:d7:71:f3:09'

Save the changes and restart the service:

/etc/init.d/salt-minion restart

Setting keys

Then connect to the Master node and check the keys that appear:

salt-key -L

Expected output:

Accepted Keys:
Denied Keys:
Unaccepted Keys:
ubuntu-sys
Rejected Keys:

Accept key:

salt-key --accept='ubuntu-sys'

You will see the following dialog box:

The following keys are going to be accepted:
Unaccepted Keys:
ubuntu-sys
Proceed? [n/Y] Y 
Key for minion ubuntu-sys accepted.

To check, run the following command:

salt-key -L

Checking the Master-Minion connection

Test the connection between Master and Minion by running the test.ping command:

salt ubuntu-sys test.ping
ubuntu-sys:
True

To check the connection between the master and all nodes, use the command:

salt '*' test.ping/noindex>

 

Welcome to the world of DomainRooster, where roosters (and hens) rule the roost! We're a one-stop shop for all your entrepreneurial needs, bringing together domain names and website hosting, and all the tools you need to bring your ideas to life. With our help, you'll soar to new heights and hatch great success. Think of us as your trusty sidekick, always there to lend a wing and help you navigate the sometimes-complex world of domain names and web hosting. Our team of roosters are experts in their fields and are always on hand to answer any questions and provide guidance. So why wait? Sign up today and join the ranks of the world's greatest entrepreneurs. With DomainRooster, the sky's the limit! And remember, as the saying goes, "Successful people do what unsuccessful people are not willing to do." So don't be afraid to take that leap of faith - DomainRooster is here to help you reach for the stars. Caw on!