100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

SaltStack Cheat Sheet

SaltStack Cheat Sheet

Reference for Salt states, the salt CLI, grains, pillars, and remote execution for configuration management at scale.

2 PagesAdvancedJan 28, 2026

Basic State (SLS)

A state file installing and running nginx.

yaml
nginx_pkg:  pkg.installed:    - name: nginxnginx_config:  file.managed:    - name: /etc/nginx/nginx.conf    - source: salt://nginx/files/nginx.conf.jinja    - template: jinja    - require:      - pkg: nginx_pkgnginx_service:  service.running:    - name: nginx    - enable: true    - watch:      - file: nginx_config

Remote Execution

Common salt CLI commands to target and control minions.

bash
salt '*' test.ping                     # Ping all minionssalt 'web*' cmd.run 'uptime'           # Run command on matching minionssalt 'web*' state.apply                # Apply the highstatesalt 'web*' state.apply nginx          # Apply a specific statesalt-key -L                            # List minion keyssalt-key -A                            # Accept all pending keys

Core Concepts

Key SaltStack terminology.

  • master / minion- Central server (master) controls managed nodes (minions) over ZeroMQ
  • state (SLS)- YAML file declaring desired system state, executed via state modules
  • grains- Static, minion-collected facts (OS, IP, hardware) used for targeting
  • pillar- Secure, minion-specific key-value data (e.g. secrets) pushed from the master
  • top.sls- Maps states to minions/environments, defining the highstate
  • execution module- Ad-hoc functions (pkg, cmd, service) runnable via 'salt' remote exec

top.sls

Maps which states apply to which minions.

yaml
base:  'web*':    - nginx    - common  'db*':    - postgres    - common
Pro Tip

Use compound target matching, e.g. salt -C 'G@os:Ubuntu and web*' state.apply, to precisely target minions by combining grains, roles, and glob patterns in one command.

Was this cheat sheet helpful?

Explore Topics

#SaltStack#SaltStackCheatSheet#DevOps#Advanced#BasicStateSLS#RemoteExecution#CoreConcepts#TopSls#CommandLine#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech

Professional Web Designing Services

  • Responsive Websites
  • E-commerce Solutions
  • SEO Friendly Design
  • Fast & Secure
  • Support & Maintenance
Get a Free Quote

Share this Cheat Sheet