Salt Project

raw JSON →
3007.14 verified Fri May 01 auth: no python

Salt (also known as SaltStack) is a Python-based open-source configuration management and remote execution system. Current version: 3007.14. Release cadence: approximately every 6 months with long-term support (LTS) releases every 2-3 years. It supports parallel execution of commands, state management, and event-driven automation across thousands of systems.

pip install salt
error ModuleNotFoundError: No module named 'salt'
cause Salt is not installed or the environment is misconfigured.
fix
Run 'pip install salt' and ensure your Python interpreter includes the installed package.
error AttributeError: module 'salt' has no attribute 'client'
cause Importing 'salt' alone does not load submodules; need explicit import.
fix
Use 'import salt.client' instead of 'import salt'.
error salt.client.LocalClient() TypeError: __init__() got an unexpected keyword argument 'mopts'
cause Old API usage with keyword argument 'mopts' (deprecated).
fix
Use 'opts' parameter: LocalClient(opts=...).
error Failed to load pillar: pillar_roots not defined
cause Missing or misconfigured pillar_roots in master config.
fix
Add 'pillar_roots: {base: /srv/pillar}' to /etc/salt/master.
deprecated salt.client.LocalClient() without arguments defaults to loading minion config from default locations, which may cause issues. Pass opts explicitly.
fix Load config with salt.config.minion_config('/etc/salt/minion') or minion_config(None) and pass to LocalClient.
breaking Starting from Salt 3006, the 'salt.runner' and 'salt.wheel' APIs changed. Direct use of run() or wheel() may fail.
fix Use salt.runner.RunnerClient or salt.wheel.WheelClient with explicit client initialization.
gotcha Salt's 'grains' and 'pillar' are lazy-loaded. Accessing them before minion startup may yield incomplete data.
fix Ensure minion is fully connected before querying grains/pillar, or use the ready grain.
deprecated The 'salt.cloud' module is deprecated in favor of salt-kubevirt and cloud plugins. Direct import of salt.cloud may stop working.
fix Use salt-cloud CLI or install cloud provider-specific packages.

Basic usage: load configuration and execute a remote command on all minions.

import salt.client
import salt.config

# Load minion config (replace with your own config path)
opts = salt.config.minion_config('/etc/salt/minion')
# Create a local client for running commands
client = salt.client.LocalClient()
# Run a test.ping on all minions
result = client.cmd('*', 'test.ping')
print(result)