Learn › Linux Automation with Salt › Set up three Salt servers
Understand the pinned installation, inspect prepared Salt packages, configure and trust one master and two minions, then verify their named replies.
Salt lets you send a command to several machines from one place. It can also keep their files, packages and services in a chosen state. Before it can do either, the machines need a way to communicate and verify who they are talking to. That is what you will set up in this lesson.
This course follows Linux Foundations. You should be comfortable entering terminal commands, reading file paths and using sudo to run an administrative command. We will explain the Salt-specific programs and settings as they appear.
The master is the Salt program that sends requests. A minion is the Salt program on a managed machine that receives and carries out those requests. You will use one master machine and two minion machines. A target selects which minion should receive a request, so the same master can ask one machine or both to answer.
Keep five questions separate as you work: Is Salt installed? Is its service running? Can the machines connect? Has the master accepted this minion's key? Did this minion answer a fresh request? Passing one question does not answer the next. Later chapters use grains, facts a minion reports about itself, for targeting; states to describe a desired configuration; and pillar for data supplied by the master. This lesson begins with the direct machine IDs.
Start the three machines and use their named terminal tabs. Each tab connects to a separate server:
| Terminal | Salt role | Private address |
|---|---|---|
salt-master | Sends requests | 10.77.0.10 |
minion-a | Runs requested work | 10.77.0.21 |
minion-b | Runs requested work | 10.77.0.22 |
An Internet Protocol (IP) address identifies a network interface; these private IP addresses let the three machines communicate with one another. Your terminal uses a separate connection, which stays available while you configure Salt. Check the terminal label before entering each command.
Installing Salt puts the needed programs on each server. On Debian 12, Advanced Package Tool (APT) is the package manager: it reads a configured software repository, verifies signed package information and installs packages and their dependencies. salt-common supplies shared Salt software; salt-master supplies the manager role; salt-minion supplies the agent role. Use the matching versions specified for this lab. A package can be installed while its service is stopped or unable to connect.
This lab's preparation installs Salt 3006.30 from its configured Salt repository before you connect. It also prepares the private addresses and base configuration. You will verify the installation, then configure and start the services and decide which keys to accept. You do not install packages in the current lab. On a fresh Debian 12 server with Salt's signed repository already configured, the installation commands for the same roles would be:
# On a master server
sudo apt-get update
sudo apt-get install salt-common=3006.30 salt-master=3006.30
# On each separate minion server
sudo apt-get update
sudo apt-get install salt-common=3006.30 salt-minion=3006.30
These are an installation example, not commands to rerun in this prepared lab. The =3006.30 part requests an exact version instead of whichever version happens to be newest in the repository. The repository and its signing key must be verified before installing on a new server; do not add an unreviewed package source to this lab. Salt's Debian installation guide gives the full repository setup. Here, inspect what preparation installed:
On salt-master, inspect the installed packages, executable and configured package source:
dpkg-query -W salt-master salt-common
salt-master --version
grep -F 'packages.broadcom.com/artifactory/saltproject-deb/' /etc/apt/sources.list.d/salt.list
On each minion, use its own terminal to inspect the installed agent:
dpkg-query -W salt-minion salt-common
salt-minion --version
grep -F 'packages.broadcom.com/artifactory/saltproject-deb/' /etc/apt/sources.list.d/salt.list
dpkg-query checks the installed package versions; --version reports the executable's version. The grep line checks the prepared Salt repository address on each server. Check that the package and program versions are 3006.30 on all three servers. If a package or source is missing, or the versions differ, use Workspace help before continuing. The Salt services should still be stopped and neither minion should be accepted yet.
Salt minions initiate connections to the master on ports 4505 and 4506 using Transmission Control Protocol (TCP). TCP carries a connection between programs; a port identifies where a program listens at an IP address. The master must listen on its private address, where these two machines can reach it. A running process alone does not prove that a remote minion can reach or trust it. Each side has a shareable public key and a secret private key. The minion sends its public key to the master; you compare its fingerprint before accepting it. SHA-256, a Secure Hash Algorithm, turns the key's bytes into a fixed-length fingerprint for this comparison. Keep each private key on its own machine.
On salt-master, identify its private address from the table above and compare it with the interface shown by ip -br address. Read the prepared course configuration with sudo cat /etc/salt/master.d/lesson-01.conf. Its values should be:
interface: 10.77.0.10
auto_accept: false
open_mode: false
hash_type: sha256
10.77.0.10 is the master's assigned private address; check that the table and interface agree. auto_accept: false means a new minion's key waits for your decision. open_mode: false keeps normal key verification enabled. If the prepared settings are correct, leave them as they are. Start the master:
sudo systemctl enable --now salt-master
sudo systemctl is-active salt-master
sudo ss -lntp '( sport = :4505 or sport = :4506 )'
sudo salt-key -F master
Check that both listeners use the assigned private address. In the last command's output, record the complete SHA-256 fingerprint beside master.pub. This is the master's public key. A fingerprint is a compact digest of a public key. Obtain this value from the authenticated master terminal; a value copied from an unknown connecting machine would not identify your master. Never copy master.pem, its private key.
The service can report active before both listeners appear. If it is active but the listener list is still empty, repeat the same ss command every few seconds, for up to one minute. If either port is still missing, or the service reports failed, read sudo journalctl -u salt-master -n 40 --no-pager before continuing. Starting a service and being ready for connections are separate events.
systemctl enable --now starts the service now and arranges for it to start after a reboot. is-active checks the current process state; ss shows the local listening addresses and ports. Neither alone proves a minion can authenticate.
First inspect minion-a before you change it. hostname identifies the terminal's machine, ip -br address shows its addresses, and is-active reports whether the agent is running:
hostname
ip -br address
sudo systemctl is-active salt-minion
It is normal for the agent to be inactive at this point. Its private address must match the table above. On minion-a, read sudo cat /etc/salt/minion.d/lesson-01.conf: it already gives this machine's ID, the master's address and SHA-256. Then open sudo nano /etc/salt/minion.d/lesson-01.conf and add the verified fingerprint so the complete file reads:
master: 10.77.0.10
id: minion-a
hash_type: sha256
master_finger: 'COMPLETE_MASTER_PUB_FINGERPRINT_FROM_MASTER_TERMINAL'
Replace the uppercase fingerprint placeholder with the complete value from your master terminal. master is the destination; master_finger is the expected public-key identity at that destination. The name in id is what the master will target. Preserve the prepared values. In nano, press Ctrl+O, then Enter to save, and Ctrl+X to exit. Start the agent:
sudo systemctl enable --now salt-minion
sudo systemctl is-active salt-minion
sudo salt-call --local key.finger hash_type=sha256
Record the complete fingerprint returned by the last command in the minion-a terminal. This is its local public key fingerprint. --local reads this machine without relying on an accepted Salt connection.
On salt-master, inspect the pending key:
sudo salt-key --list all
sudo salt-key -f minion-a
The first authentication request may take several seconds to arrive. If minion-a is not listed yet, repeat these two read-only commands every few seconds, for up to one minute. Do not accept a different name while waiting. If the key remains absent, read the minion's recent service messages with sudo journalctl -u salt-minion -n 40 --no-pager before changing its settings.
Compare the entire pending minion-a fingerprint with the value you obtained directly on minion-a. A matching name alone is insufficient. If either value is missing or they differ, stop and inspect the configuration and service logs; do not accept a key. If they match, accept only this identity and check the result:
sudo salt-key -a minion-a
sudo salt --timeout=10 'minion-a' test.ping
The accept command asks for confirmation. Confirm only when it names minion-a. Accepting a key permits communication; it does not prove the minion has finished connecting or will answer a request. The Salt command should return the named minion with True, meaning it answered this request. --timeout=10 sets the Salt reply-wait interval; total command time can be longer. An absent reply is not a returned False. This is a Salt application response. The ordinary ping command uses Internet Control Message Protocol (ICMP) to test a different network path. If the first request has no named reply just after acceptance, wait briefly and run a fresh test.ping. If it still has no reply, use sudo journalctl -u salt-minion -n 40 --no-pager on minion-a to read recent service messages and inspect its connection before changing anything. These are example steps and an expected result; inspect your own terminal for real evidence.
Now use the same method on a second real server, with the steps beside you. You can replay the minion-a example or use setup help at any time, without a score penalty. The decision is the same: read the key on this minion through its own authenticated terminal, then compare it with the pending key shown by the master. A matching name alone is not enough.
On minion-b, inspect its machine name, private address, prepared configuration and stopped service:
hostname
ip -br address
sudo cat /etc/salt/minion.d/lesson-01.conf
sudo systemctl is-active salt-minion
Check for master: 10.77.0.10, id: minion-b and hash_type: sha256. The private address should be 10.77.0.22. If these disagree, ask for setup help before editing. On salt-master, reread sudo salt-key -F master and take the full fingerprint beside master.pub. On minion-b, open sudo nano /etc/salt/minion.d/lesson-01.conf, add master_finger: 'COMPLETE_MASTER_PUB_FINGERPRINT_FROM_MASTER_TERMINAL' with your real value, preserve the prepared lines, then run:
sudo systemctl enable --now salt-minion
sudo systemctl is-active salt-minion
sudo salt-call --local key.finger hash_type=sha256
Read the last fingerprint from minion-b's own terminal. On salt-master, run sudo salt-key --list all and sudo salt-key -f minion-b. The latter must match the complete fingerprint from minion-b before you accept anything. If the key has not arrived yet, repeat those read-only checks every few seconds for up to one minute, as in the worked example. If it remains absent, inspect the minion service and its private route. If the fingerprints differ, stop immediately and use help. Leave minion-b pending for one nearby prediction.
Before asking Salt to contact the still-pending minion, consider: will sudo salt --timeout=5 'minion-b' test.ping return a named True? State why, or record uncertainty and continue. Now run that command on salt-master and inspect the actual result. A pending key shows that a minion's authentication request reached the master. It does not grant that minion permission to receive Salt jobs yet. Inspect the key state together with the command result; an absent result is not a False reply. Compare what happened with your prediction before accepting the key.
If the complete fingerprints matched in your rehearsal, accept only minion-b on salt-master, then make a fresh named request:
sudo salt-key -a minion-b
sudo salt --timeout=10 'minion-b' test.ping
Confirm the accept prompt names minion-b. Leave unrelated pending keys alone. Do not use salt-key -A, which would accept every pending key. A named True supports a live, accepted Salt reply. If the first request has no named reply immediately after acceptance, wait briefly and send a fresh request. Continued absence calls for the minion service and connection checks from the worked example, not an assumption that the key was wrong.
On salt-master, send separate requests first:
sudo salt --timeout=10 'minion-a' test.ping
sudo salt --timeout=10 'minion-b' test.ping
Read each named result. Then request both IDs in a single target list:
sudo salt --timeout=10 -L 'minion-a,minion-b' test.ping
The -L list is an explicit target containing two minion IDs. Check for both named True results; the command's exit status or one reply does not prove both answered. Compare these observations with your prediction. If one ID is absent, inspect that minion rather than treating absence as a returned False. test.ping checks a live Salt request and reply. The ordinary ping command sends ICMP packets and tests a different path.
If a minion is missing, use its terminal to compare the installed version, service state, configured master address, network path to the master's private address, and recent service messages. Change the specific wrong setting or start the stopped service, then repeat the targeted request. If both minions already answer and their keys match the intended machines, leave the configuration alone; making an unnecessary change is not the goal.
Finish with sudo salt-key --list=accepted, a fresh targeted test.ping for each ID, and the two-ID list request. Verify the accepted set contains only minion-a and minion-b, all three terminal tabs still work, and no unrelated key was accepted. These observations establish this lab's current setup and live Salt replies. They do not prove every service on either minion is healthy or that the setup will remain healthy indefinitely. Use Check chapter for automatic feedback on the actual machines; reading and copied commands alone do not earn machine-state credit.
In a later Salt lesson, revisit targeting with less help. You will select only one of the two enrolled minions for a harmless read, then check that the other machine was not selected. Explain the target, the named replies and what a missing reply leaves unknown. The current enrollment is guided practice; the later changed case is a separate attempt, not a claim of independent mastery today.
Practice Set up three Salt servers in a real Linux terminal at The Linux Camp. Progress is verified automatically as you type commands on the machine.