Linux command
salt-call 命令
趣味
复制后可按需替换文件名、目录或参数。
常用示例
Run state locally
salt-call state.apply
Run specific state
salt-call state.apply [apache]
Execute module function
salt-call cmd.run 'uname -a'
Run in local mode
salt-call --local grains.items
Test mode
salt-call state.apply test=True
Show output in JSON format
salt-call --output json grains.items
Run with debug logging
salt-call --log-level=debug state.apply
说明
salt-call runs Salt execution modules and states directly on a minion without going through the Salt master. This is useful for testing, debugging, and masterless Salt configurations where the minion applies states independently. When used with --local, it operates completely independently of a master, making it ideal for standalone configuration management or testing states before deploying them across infrastructure.
参数
- --local
- Run without connecting to a Salt master. Uses local file client.
- --grains
- Return minion grain data.
- --pillar _data_
- Set pillar data as a dictionary (e.g., '{"key": "value"}').
- --output _format_
- Output format: json, yaml, nested, raw, highstate, quiet, etc.
- --state-output _mode_
- State output verbosity: full, terse, mixed, changes.
- --log-level _level_
- Log level: all, garbage, trace, debug, info, warning, error, critical, quiet.
- --id _MINION_ID_
- Specify the minion ID (overrides the configured minion ID).
- --retcode-passthrough
- Exit with the Salt command return code, useful for scripting.
- --no-color
- Disable colored output.
FAQ
What is the salt-call command used for?
salt-call runs Salt execution modules and states directly on a minion without going through the Salt master. This is useful for testing, debugging, and masterless Salt configurations where the minion applies states independently. When used with --local, it operates completely independently of a master, making it ideal for standalone configuration management or testing states before deploying them across infrastructure.
How do I run a basic salt-call example?
Run `salt-call state.apply` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --local do in salt-call?
Run without connecting to a Salt master. Uses local file client.