Qadry
unixcop Admin

How to Install SaltStack Master on CentOS 8/ RHEL 8

Introduction

Salt (sometimes referred to as SaltStack) is Python-based, open-source software for event-driven IT automation, remote task execution, and configuration management. Supporting the “infrastructure as code” approach to data center system and network deployment and management, configuration automation, SecOps orchestration, vulnerability remediation, and hybrid cloud control.

SaltStack Master is the server node, it is the central server that controls all the Salstack Minions.

Master server holds the Inventory and Public Keys of Minions and perform remote execution on them.

The Salt master daemon, used to control the Salt minions.

So in this tutorial, we will show you how to install and configure the saltstack master on your CentOS & RHEL 8.

Installation

Just follow the steps and Notes below

  • Update your system
dnf update -y
  • SaltStack requires Python language support for compilation and execution of SaltStack commands. So Install Python3
dnf install python3 -y
  • Install SaltStack which is available via EPEL yum repo.
dnf install https://repo.saltstack.com/py3/redhat/salt-py3-repo-latest.el8.noarch.rpm -y
  • Then build the cache for the new repo added.
dnf makecache
  • Then Install SaltStack and all required packages
dnf install salt-master salt-minion salt-cloud salt-syndic salt-api salt-ssh -y

Note: So  as you see we installed the salt-minion package on SaltStack Master, because the Minion will collect and send the system metrics of the Master, even on the same server. Kindly visit the salt-minion installation guide below.

Configuration

  • You need to adjust SaltStack Minion configurations before starting the service.
vim /etc/salt/minion
  • Search on this directive
#master: salt
  • Then replace it with following.
master: saltstack-master.unixcop.com

Note: The master directive tells the Minion about the Master server in use.

  • Also The SaltStack master hostname must be resolvable. So do this by using Local DNS Resolver by modifying the IP and the hostname in /etc/hosts file on your current server as shown.
  • Enable and start Master and Minion.
systemctl enable --now salt-master salt-minion
  • Add the default ports 4505/tcp and 4506/tcp for Saltstack on firewall.
firewall-cmd --permanent --add-port={4505,4506}/tcp
firewall-cmd --reload
  • Then you have to Manage the SaltStack Public Keys.

Note: The SaltStack minion send its public key to the SaltStack master. This public key must be accepted by the Master to allow a Minion to communicate with SaltStack Master.

  • List all the SaltStack public keys with the command below.
salt-key -L
  • As shown above, there is a public key existed in the unaccepted keys, So accept this public key with the command below.
 salt-key -A
  • Check again if this public key was_ added in the accepted keys or not with running the below command again
salt-key -L
  • Execute ping command on all the minions.
salt '*' test.ping
  • Check versions of all the minions.
salt '*' test.version

Conclusion

So in this tutorial, we illustrated how to install and configure SaltStack Master on CentOS / RHEL 8.

Kindly don’t forget to visit the Saltstack-minion Installation guide.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

x