Saltstack Installation and Quickstart

What is Saltstack and How to Install It

In this tutorial you will know what is Salt, how to install it and a Quick commands to get you started.

What is Salt ?

Short answer:
Salt is an infrastructure and package management tool, it will help you to automate packaging, infrastructure installation and package management.

Detailed:

Salt is a different approach to infrastructure management, founded on the idea that high-speed communication with large numbers of systems can open up new capabilities. This approach makes Salt a powerful multitasking system that can solve many specific problems in an infrastructure.

The backbone of Salt is the remote execution engine, which creates a high-speed, secure and bi-directional communication net for groups of systems. On top of this communication system, Salt provides an extremely fast, flexible, and easy-to-use configuration management system called Salt States.

Install Stack

 

#1 Using YUM Repo

You can simply add the following to your Yum repo

 

vi /etc/yum.repos.d/salt.repo

 

[salt]
name=SaltStack repo for Red Hat Enterprise Linux $releasever
baseurl=https://repo.saltstack.com/yum/redhat/$releasever/$basearch/latest
enabled=1
gpgcheck=1
gpgkey=https://repo.saltstack.com/yum/redhat/$releasever/$basearch/latest/SALTSTACK-GPG-KEY.pub
https://repo.saltstack.com/yum/redhat/$releasever/$basearch/latest/base/RPM-GPG-KEY-CentOS-7

 

Yum clean expire-cache

Or

Yum clean all

yum install salt-master

 

#2 Install Saltstack "Masterless"

 

curl -L https://bootstrap.saltstack.com -o bootstrap_salt.sh
sudo sh bootstrap_salt.sh

 

Configure Saltstack

mkdir /srv/salt
vi /srv/salt/top.sls

In this top.sls we will put the name of the server, you can add webserver as a word or whatever and then create sls to match the name, now I want Salt to do server tuning so I will call it tuning.

ex.:

base:
'*':
-- webserver
-- tuning  

Now create a new file webserver.sls ,  and will show you later how tuning is used

vi /srv/salt/webserver.sls

 

mypkgs:
pkg.installed:
-- pkgs:
-- httpd
-- openssl

I will create another file called tuning.sls that I mentioned earlier in the top.sls

vi /srv/salt/tuning.sls

You can in the tuning create user, change filesystem...etc , check available options here.

 

Run Saltstack

To make Salt run the above recipe locally, run below command

 

salt-call --local state.apply

 

 

 


Subscribe to
for video tutorials updates