Salt Calls

Salt calls have three main components: target, function, and arguments. The calls are constructed in this format:

salt 'target' <function> [arguments]

The target defines the client, or group of clients, on which to run the function.

The function is the particular task to be run.

Arguments provide any extra data required by the function.

Salt Call Targets

Salt call targets allow you to specify a client or group of clients. There are several different targets you can use.

General Targeting

List available grains on all clients:

salt '*'

Target a specific client:

salt ''
Glob Targeting

Target all clients using a particular domain:

salt '*'

Target all clients using a particular label:

salt 'label*'
List Targeting

Specify a flat list of clients, using their IDs:

salt -L 'client_ID1, client_ID2, client_ID3'
Regular Expression Targeting

You can also define targets with PCRE-compliant regular expressions:

salt -E '(?!web)'
IP Address Targeting

List available client IP addresses:

salt '*' network.ip_addrs

Target a specific client IP address:

salt -S ''

Target all clients on a subnet:

salt -S

Salt Call Functions

When you have specified a target, provide the function to call on the target.

Find which functions can be called on the target:

salt '*' sys.doc

For a full list of callable functions, see

Salt Call Arguments

Functions accept arguments for any extra data.

For example, the pkg.install function requires an argument specifying which package to install:

salt '*' pkg.install yast2

You can provide more than one argument to a function, with spaces between them. For example:

salt '*' 'echo "Hello: $FIRST_NAME"' env='{FIRST_NAME: "John"}'