Salt · configuration management

Also known as: SaltStack

On this page 7

Salt, also known as SaltStack, is an open-source configuration management and remote execution engine that brings servers, virtual machines and network devices into a declared state and runs commands across thousands of them in parallel. Within infrastructure as code for the Cloud, Salt belongs to the configuration layer: it shapes the operating system and software of machines that already exist, while provisioning tools such as Terraform create those machines in the first place.

Salt was first released in 2011, and its distinguishing design choice is an event-driven message bus rather than periodic polling. That bus lets a central controller push changes to large fleets within seconds and react automatically to events. Not to be confused with the cryptographic salt used in password hashing, which is an unrelated concept.

How Salt applies configuration management

Salt works through a master and minion architecture in which a central Salt master sends instructions to agents called minions running on each managed host. Communication runs over ZeroMQ by default on TCP ports 4505 and 4506: the first port publishes jobs to all minions, and the second collects their returns. Each minion authenticates with an RSA key pair that the master must accept before any job is delivered.

Desired configuration is written in state files (SLS files), which are YAML documents rendered through Jinja templating by default. A state declares the end result, such as a package installed, a file with specific content or a service running, and Salt computes the actions needed to reach it. Because most state functions are idempotent, applying the same state twice produces no further changes once the system complies.

The following table lists the core components an engineer meets when reading or designing a Salt deployment.

ComponentRoleTypical content
Salt masterPublishes jobs and serves filesConfiguration, keys, state tree
MinionAgent that executes jobs locallyGrains, cached states
State (SLS) fileDeclares the desired end stateYAML with Jinja logic
Top fileMaps states to groups of minionsTargeting rules per environment
GrainsStatic facts reported by a minionOS, CPU, memory, roles
PillarPrivate data assigned by the masterSecrets, per-host variables
Execution moduleFunction run on demandPackage, service, file actions
Core components of a Salt deployment

Remote execution, events and reactors

Beyond declarative states, Salt is a remote execution framework: a command such as salt 'web*' pkg.upgrade runs an execution module on every matching minion at once and returns structured results. Targeting can match minion IDs with globs or regular expressions, grains, pillar values, node groups or compound expressions, so operators address a precise slice of the fleet.

Every job, login and state run emits a message on the Salt event bus. The reactor system listens for chosen event tags and triggers states in response, for example accepting a new minion key and applying a baseline. Beacons on minions watch local conditions, such as a changed file or high disk usage, and publish events that reactors can handle. This combination supports event-driven automation and limited self-healing without an external orchestrator.

Salt offers several operating modes, and the right one depends on network topology and how much infrastructure a team is willing to run.

ModeHow it connectsBest fit
Master and minionPersistent agent over ZeroMQLarge, long-lived fleets
Masterlesssalt-call --local on each hostImage builds, edge devices
Salt SSHAgentless over SSHHosts where agents are banned
Proxy minionAgent speaks to device APIsSwitches, routers, appliances
SyndicMaster of masters hierarchyMulti-region or very large estates
Salt operating modes and when each fits

Salt compared with other configuration tools

Salt competes most directly with Ansible, Puppet and Chef, and the differences lie in transport, language and execution model. Ansible is agentless and pushes tasks over SSH, which is simple but slower at scale. Puppet and Chef rely on agents that pull configuration on a schedule, typically every 30 minutes, whereas Salt pushes on demand and can also schedule runs.

The table summarizes these trade-offs; real performance depends on network latency, state complexity and hardware.

ToolModelLanguageNotable strength
SaltPush and pull, agent or SSHYAML with Jinja, PythonSpeed and event reactors
AnsiblePush, agentlessYAML playbooksLow setup effort
PuppetPull, agentPuppet DSLMature reporting and modeling
ChefPull, agentRuby DSLFlexible programmatic recipes
TerraformPlan and apply via APIsHCLProvisioning cloud resources
Salt and neighboring configuration management tools

Salt is therefore complementary to Terraform rather than a replacement: a typical pipeline provisions instances with Terraform or cloud-init and then hands them to Salt for ongoing configuration and drift correction. Teams that prefer immutable infrastructure often run Salt masterless inside Packer builds instead of reconfiguring live servers.

Designing a maintainable Salt codebase

A maintainable Salt repository separates reusable formulas from site-specific data. Formulas are versioned state collections for one service, such as nginx or PostgreSQL, while pillar data supplies the hostnames, ports and credentials. Keeping secrets in pillar, ideally encrypted with GPG renderers or fetched from a vault, prevents them from leaking into the state tree, which every minion can read.

  • Store the state tree and pillar in Git and serve them through GitFS or a CI-built file root.
  • Use test=True dry runs before applying states to production minions.
  • Declare ordering with requisites such as require, watch and onchanges instead of relying on file order.
  • Limit Jinja logic in states; move complex decisions into custom execution modules written in Python.

Limitations, risks and common mistakes

Salt is powerful but unforgiving: the master holds root-level control over every minion, so its compromise compromises the whole estate. In 2020, critical vulnerabilities in the master’s request server (CVE-2020-11651 and CVE-2020-11652) were exploited against masters exposed to the internet, which made never exposing ports 4505 and 4506 publicly a firm rule. Salt became part of VMware in 2020 and then of Broadcom, and some users report concern about the project’s long-term direction.

The table connects frequent operational symptoms with their usual causes and remedies.

SymptomLikely causeFix
Minion not respondingUnaccepted key or blocked portsCheck salt-key, firewall rules
States change on every runNon-idempotent cmd.run usageAdd unless, onlyif or creates
Wrong values renderedPillar not refreshed after editsRun saltutil.refresh_pillar
Slow highstateHeavy Jinja loops, large file servingSimplify templates, cache files
Secrets in Git historyCredentials placed in statesMove to encrypted pillar
Frequent Salt problems and how to fix them

Another common mistake is treating Salt as a substitute for monitoring. Configuration drift is only corrected when a state run happens, so teams should schedule highstates or use beacons and reactors rather than assuming the fleet stays compliant between runs.

In plain words

Salt is like a head office that can send the same instruction to thousands of branch offices at the same moment. Each server runs a small helper that listens for orders, carries them out and reports back. Instead of logging in to every machine to install software or change a setting, an administrator writes down once how the machines should look, and Salt makes every machine match that description.

If a machine drifts away from that description, for example because someone changed a file by hand, the next Salt run puts it back. The main point is consistency at speed: many machines, one written plan, and results within seconds.

A real-world example

An online retailer runs about 2,000 Linux servers across two cloud regions. Instances are created with Terraform, and on first boot cloud-init installs the Salt minion and points it at a regional master. A reactor watches for new key events, accepts keys that match the expected naming pattern and applies a baseline highstate that hardens SSH, installs monitoring agents and configures time synchronization.

When a severe OpenSSL vulnerability is announced, the operations team targets every minion with the grain role:web, runs a test=True preview on a small canary group, and then upgrades the package across about 1,200 web servers in under ten minutes. A beacon also reports any manual change to the nginx configuration, and the reactor restores the approved version automatically. The result is a patched, consistent fleet without anyone logging in to individual hosts.