=============
``salt-call``
=============

Synopsis
========

.. code-block:: bash

    salt-call [options]

Description
===========

The salt-call command is used to run module functions locally on a minion
instead of executing them from the master. Salt-call is used to run a
:ref:`Standalone Minion <tutorial-standalone-minion>`, and was originally
created for :ref:`troubleshooting <troubleshooting-minion-salt-call>`.

The Salt Master is contacted to retrieve state files and other resources
during execution unless the ``--local`` option is specified.

.. note::

    ``salt-call`` commands execute from the current user's shell
    context, while ``salt`` commands execute from the system's default context.

Options
=======

.. program:: salt-call

.. include:: _includes/common-options.rst

.. option::  --hard-crash

    Raise any original exception rather than exiting gracefully Default: False

.. option:: -g, --grains

    Return the information generated by the Salt grains

.. option:: -m MODULE_DIRS, --module-dirs=MODULE_DIRS

    Specify an additional directory to pull modules from.  Multiple directories
    can be provided by passing -m /--module-dirs multiple times.

.. option:: -d, --doc, --documentation

    Return the documentation for the specified module or for all modules if
    none are specified

.. option:: --master=MASTER

    Specify the master to use. The minion must be authenticated with the
    master. If this option is omitted, the master options from the minion
    config will be used. If multi masters are set up the first listed master
    that responds will be used.

.. option:: --return RETURNER

    Set salt-call to pass the return data to one or many returner interfaces.
    To use many returner interfaces specify a comma delimited list of
    returners.

.. option:: --local

    Run salt-call locally, as if there was no master running.

.. option:: --file-root=FILE_ROOT

    Set this directory as the base file root. Can be specified more than once
    to include multiple base file roots.

.. option:: --pillar-root=PILLAR_ROOT

    Set this directory as the base pillar root. Can be specified more than
    once to include multiple base pillar roots.

.. option:: --states-dir=STATES_DIR

    Set this directory to search for additional states. Can be specified more
    than once to include multiple states directories.

.. option:: --retcode-passthrough

    Exit with the salt call retcode and not the salt binary retcode

.. option:: --no-return-event

    Do not send the return event back to master.

.. option:: --metadata

    Print out the execution metadata as well as the return. This will print out
    the outputter data, the return code, etc.

.. option:: --id=ID

    Specify the minion id to use. If this option is omitted, the id option from
    the minion config will be used.

.. option:: --skip-grains

    Do not load grains.

.. option:: --refresh-grains-cache

    Force a refresh of the grains cache

.. option:: -r, --resources

    .. versionadded:: 3008.0

    Dispatch the call to managed resources in addition to the managing
    minion. Without ``-r``, ``salt-call`` runs the function on the
    managing minion only and returns a single bare value, preserving
    legacy script behaviour. With ``-r``, the function runs against
    every resource matched by ``--tgt`` and the result is a dict keyed
    by resource id (or by managing-minion id, for the host itself).

    See :ref:`resources-operations` for usage and :ref:`resources` for
    background.

.. option:: --tgt=TGT

    .. versionadded:: 3008.0

    Targeting expression. Only honoured when ``-r``/``--resources`` is
    also passed. Default ``*`` — matches the managing minion and all
    managed resources. Supports all targeting forms documented in
    :ref:`resources-targeting`, controlled by ``--tgt-type``.

.. option:: --tgt-type=TGT_TYPE

    .. versionadded:: 3008.0

    Targeting expression type. Only honoured when ``-r``/``--resources``
    is also passed. Mirrors the master CLI's ``-t``/``--target-type``
    options. Common values: ``glob`` (default), ``compound``, ``grain``,
    ``grain_pcre``, ``list``, ``pillar``, ``range``, ``pcre``.

.. include:: _includes/logging-options.rst
.. |logfile| replace:: /var/log/salt/minion
.. |loglevel| replace:: ``warning``

.. include:: _includes/output-options.rst


See also
========

:manpage:`salt(1)`
:manpage:`salt-master(1)`
:manpage:`salt-minion(1)`
