Document availability of templating variables, Fix #9261

This commit is contained in:
Colton Myers 2013-12-18 11:13:21 -07:00
parent 8034d126e2
commit d61a93fde5

View File

@ -4,14 +4,16 @@ SLS Template Variable Reference
The template engines available to sls files and file templates come loaded The template engines available to sls files and file templates come loaded
with a number of context variables. These variables contain information and with a number of context variables. These variables contain information and
functions to assist in the generation of templates. functions to assist in the generation of templates. See each variable below
for its availability -- not all variables are available in all templating
contexts.
Salt Salt
==== ====
The `salt` variable is available to abstract the salt library functions. This The `salt` variable is available to abstract the salt library functions. This
variable is a python dictionary containing all of the functions available to variable is a python dictionary containing all of the functions available to
the running salt minion: the running salt minion. It is available in all salt templates.
.. code-block:: jinja .. code-block:: jinja
@ -24,7 +26,8 @@ Opts
==== ====
The `opts` variable abstracts the contents of the minion's configuration file The `opts` variable abstracts the contents of the minion's configuration file
directly to the template. The `opts` variable is a dictionary. directly to the template. The `opts` variable is a dictionary. It is available
in all templates.
.. code-block:: jinja .. code-block:: jinja
@ -35,7 +38,8 @@ The ``config.get`` function also searches for values in the `opts` dictionary.
Pillar Pillar
====== ======
The `pillar` dictionary can be referenced directly: The `pillar` dictionary can be referenced directly, and is available in all
templates:
.. code-block:: jinja .. code-block:: jinja
@ -53,7 +57,8 @@ is not available in pillar and dictionaries can be traversed directly:
Grains Grains
====== ======
The `grains` dictionary makes the minion's grains directly available: The `grains` dictionary makes the minion's grains directly available, and is
available in all templates:
.. code-block:: jinja .. code-block:: jinja
@ -69,8 +74,8 @@ defaults:
env env
==== ====
The `env` variable is available in sls files when gathering the sls from The `env` variable is available in only in sls files when gathering the sls
an environment. from an environment.
.. code-block:: jinja .. code-block:: jinja
@ -79,8 +84,10 @@ an environment.
sls sls
==== ====
The `sls` variable contains the sls reference value. The sls reference value The `sls` variable contains the sls reference value, and is only available in
is the value used to include the sls in top files or via the include option. the actual SLS file (not in any files referenced in that SLS). The sls
reference value is the value used to include the sls in top files or via the
include option.
.. code-block:: jinja .. code-block:: jinja