Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional documentation on calling exec modules from templates #32657

Merged
merged 1 commit into from
Apr 18, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Additional documentation on calling exec modules from templates
Refs #32612
  • Loading branch information
Mike Place committed Apr 18, 2016
commit 5435c738bf719674fcd43def486c0d3c65e466b5
15 changes: 15 additions & 0 deletions doc/topics/tutorials/states_pt3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,24 @@ modules.
The Salt module functions are also made available in the template context as
``salt:``

The following example illustrates calling the ``group_to_gid`` function in the
``file`` execution module with a single positional argument called
``some_group_that_exists``.

.. code-block:: jinja

moe:
user.present:
- gid: {{ salt['file.group_to_gid']('some_group_that_exists') }}

One way to think about this might be that the ``gid`` key is being assigned
a value equivelent to the following python pseudo-code:

.. code-block:: python

import salt.modules.file
file.group_to_gid('some_group_that_exists')

Note that for the above example to work, ``some_group_that_exists`` must exist
before the state file is processed by the templating engine.

Expand All @@ -145,6 +157,9 @@ MAC address for eth0:

salt['network.hw_addr']('eth0')

To examine the possible arguments to each execution module function,
one can examine the `module reference documentation </ref/modules/all>`:

Advanced SLS module syntax
==========================

Expand Down