salt-call
Execute Salt modules locally on a minion
TLDR
Perform a highstate on this minion
Perform a highstate dry-run, compute all changes but don't actually perform them
Perform a highstate with verbose debugging output
List this minion's grains
SYNOPSIS
salt-call [options]
PARAMETERS
--help
Show the help message and exit.
--version
Show program's version number and exit.
--config-dir
The location of the Salt configuration directory.
--local
Run in local mode (no master required).
--minion-id
Specify the minion ID.
--file-root
Specify an alternative file root.
--pillar-root
Specify an alternative pillar root.
--retcode-passthrough
Pass the return code of the called function to the shell.
--out
Define an alternative outputter.
--out-file
Write the output to the specified file.
--log-level
Specify the log level (e.g., debug, info, warning, error, critical).
--hard-crash
Raise any exceptions encountered in salt-call.
--master
Override the master address.
DESCRIPTION
The `salt-call` command allows you to execute Salt functions directly on a Salt minion. It's useful for testing states, modules, or just general Salt functionality without relying on a Salt master. It's a powerful tool for troubleshooting and local administration tasks.
Using `salt-call`, you specify the function to execute along with any necessary arguments. The command then executes the function on the local minion and returns the result. This can be beneficial when you want to quickly verify the behavior of a Salt function or state before deploying it through a master-based configuration. `salt-call` can also be used to run ad-hoc commands on a single machine, even without the central Salt management infrastructure.
It supports a wide variety of options for configuring the execution environment, including setting the log level, specifying configuration directories, and using custom grains. These options allow you to fine-tune the execution of Salt functions to match your specific needs.
CAVEATS
When running `salt-call` without `--local`, it still attempts to connect to a Salt master, even if you only intend to execute functions locally. This can lead to unexpected behavior if the minion is not properly configured to connect to a master or if the master is unavailable.
LOCAL MODE
When using `--local`, `salt-call` will only use the minion's configuration files to define its environment and will not attempt to contact a Salt master. This is useful for running Salt functions in isolation.
RETURN DATA
The return data from `salt-call` is generally in a dictionary format. The first key is always the minion ID, and the value is another dictionary containing the function's results. This format is similar to that seen with master-based Salt commands.
HISTORY
The `salt-call` command was developed as part of the SaltStack project to enable local execution of Salt functions. It has evolved over time with new features and options to support more complex scenarios and improved debugging capabilities. It has become a core tool for Salt administrators and developers.
SEE ALSO
salt(1), salt-minion(8)