How to install Saltstack Configuration Management tool in Centos Linux

In this guide, we are about to go through how to setup Saltstack configuration management tools in Centos Linux.

Install with two servers for SaltStack Server and Salt minion (client) server.

Set the hostname for salt server and minion server.

# hostnamectl set-hostname
# hostnamectl set-hostname

Hence we don’t have a DNS server adding localhost hosts entry. saltmaster salt minion

By default, Saltstack server will use below ports. If we have firewalld enabled required to create firewalld rules.

4505 and 4506

To begin the installation add the yum repo

# sudo yum install sudo yum install salt-master
# sudo yum install salt-minion
# sudo yum install salt-ssh
# sudo yum install salt-syndic
# sudo yum install salt-cloud
# sudo yum install salt-api

The salt master configuration will be under location.

# ls -lthr /etc/salt

By default saltmaster will listen to all interfaces, to listen on only specific interface define directive as follows in master configuration.

# vi /etc/salt/master

log_file: /var/log/salt/master

Save the configuration and start the salt master using below commands.

# systemctl status salt-master
# systemctl start salt-master

Client Side Configuration:

Install with the same repository as above, and install with only the client side package.

# sudo yum install
# sudo yum install salt-minion

Modify the client side configuration to talk with the salt master server by defining required directive.

# vi /etc/salt/minionmaster:
pidfile: /var/run/

Start the client service and check for status.

# systemctl start salt-minion
# systemctl status salt-minion

List aall the keys in master server

# salt-key -F master

To list the keys in minion server

# salt-call --local key.finger

To list pending keys and to accept pending keys.

# salt-key -P
# salt-key -A

Few ad-hoc commands

# salt '*'

Few ad-hoc commands

Sample Output:

[root@saltmaster ~]# salt '*' True [root@saltmaster ~]#

To check uptime.

# sudo salt '*' "uptime"

Sample Output:

[root@saltmaster ~]# sudo salt '*' "uptime"
12:50:38 up 12:57, 1 user, load average: 0.00, 0.01, 0.05
[root@saltmaster ~]#

Mount point details

# sudo salt '*' df

Sample Output:

[root@saltmaster ~]# sudo salt '*' df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/linixvideogeek-root 10475520 4598156 5877364 44% /
devtmpfs 165984 0 165984 0% /dev
tmpfs 176392 12 176380 1% /dev/shm
tmpfs 176392 12780 163612 8% /run
tmpfs 176392 0 176392 0% /sys/fs/cgroup
/dev/sda1 508588 172752 335836 34% /boot
/dev/mapper/linixvideogeek-home 1038336 33012 1005324 4% /home
tmpfs 35280 0 35280 0% /run/user/0
[root@saltmaster ~]#

To check the free output

# sudo salt '*' free

Sample Output:

[root@saltmaster ~]# sudo salt '*' free
total used free shared buff/cache available
Mem: 352784 159368 48740 12432 144676 126556
Swap: 524284 3792 520492
[root@saltmaster ~]#

Listing all available minion functions.

# salt '*' sys.doc

# salt '*' disk.usage

# salt '*' pkg.install vim

# salt '*' 'ls -l /etc'

# salt '*' network.interfaces

To make more configuration under salt master we can uncomment and add more directives as per the requirement for our environment.

Leave a Comment

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

We promise not to spam you, and we don't usually send more than one email a week.

You have Successfully Subscribed!