Skip to content

Commit

Permalink
Additional documentation on calling exec modules from templates (#32657)
Browse files Browse the repository at this point in the history
Refs #32612
  • Loading branch information
Mike Place authored and Nicole Thomas committed Apr 18, 2016
1 parent c910b8d commit 77bea56
Showing 1 changed file with 15 additions and 0 deletions.
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

0 comments on commit 77bea56

Please sign in to comment.