mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Update py
renderer documentation with information on user-provided context
Update the `py` renderer's documentation to include information on how user-provided context data is typically presented.
This commit is contained in:
parent
4fc4450bf0
commit
e8e033a8f7
1 changed files with 17 additions and 2 deletions
|
@ -46,8 +46,23 @@ execution functions, grains, pillar, etc. They are:
|
|||
``/srv/salt/foo/bar/baz.sls``, then ``__sls__`` in that file will be
|
||||
``foo.bar.baz``.
|
||||
|
||||
When writing a reactor SLS file the global context ``data`` (same as context ``{{ data }}``
|
||||
for states written with Jinja + YAML) is available. The following YAML + Jinja state declaration:
|
||||
When used in a scenario where additional user-provided context data is supplied
|
||||
(such as with :mod:`file.managed <salt.states.file.managed>`), the additional
|
||||
data will typically be injected into the script as one or more global
|
||||
variables:
|
||||
|
||||
.. code-block:: jinja
|
||||
/etc/http/conf/http.conf:
|
||||
file.managed:
|
||||
- source: salt://apache/generate_http_conf.py
|
||||
- template: py
|
||||
- context:
|
||||
# Will be injected as the global variable "site_name".
|
||||
site_name: {{ site_name }}
|
||||
|
||||
When writing a reactor SLS file the global context ``data`` (same as context
|
||||
``{{ data }}`` for states written with Jinja + YAML) is available. The
|
||||
following YAML + Jinja state declaration:
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue