Saltstack – Installation

Install Master

CentOS 7

yum install https://repo.saltstack.com/yum/redhat/salt-repo-latest.el7.noarch.rpm

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

Add to autorun and run:

systemctl enable salt-master
systemctl start salt-master

Installation may require dependencies in the EPEL repository.

yum install epel-release

 

Ubuntu – 18.04

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

echo -e "deb http://repo.saltstack.com/apt/ubuntu/18.04/amd64/latest bionic main" > /etc/apt/sources.list.d/saltstack.list

apt update

apt install salt-master salt-minion salt-ssh salt-syndic salt-cloud salt-api

Add to autorun and run:

systemctl enable salt-master
systemctl start salt-master

In Salt, the minions connect to the master, so it’s enough to open TCP ports 4505,4506 on the master for Saltstack to work.

 

Minion installation

CentOS:

yum install salt-minion salt-ssh

Ubuntu:

apt install salt-minion salt-ssh

Add to autorun and run:

systemctl enable salt-minion
systemctl start salt-minion

 

Connection:

By default, the minions are looking for a wizard on the network named "salt".

To change, either in the file "/etc/salt/minion" find the line:

#master: salt

Uncomment and change the name, or specify the IP address, then restart the minion, or write in the "/etc/hosts" record "salt" with the IP address of the master.

On the wizard, see the requests to add:

salt-key -L
Accepted Keys:
Denied Keys:
Unaccepted Keys:
ip-172-31-22-119.ec2.internal
Rejected Keys:

And we see:

Unaccepted Keys:
ip-172-31-22-119.ec2.internal

That one key is awaiting approval. To take all the keys at once, do:

salt-key -A

This is if you are sure that this is exactly your minions. If not, verify key prints.

 

Examples of simple commands.

salt '*' test.ping

We check the "alive" of all the minions, in response they should just send the answer "True"

ip-172-31-22-119.ec2.internal:
    True

We execute the remote command on all the minions, in this case, this is the listing of the "/home" directory

salt '*' cmd.run 'ls -l /home/'

Install the package "vim" on all minions

salt '*' pkg.install vim

Tagged: Tags

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments