Salt Stack

(I have not used this in years. Salt was horrible.)

Fetching pillar data in templates

In the Jinja2 context, pillar is just a dictionary, so you can use the usual Python dictionary methods, e.g.:

{% for user, uid in pillar.get('users', {}).items() %}
    - uid: {{uid}}
{% endfor %}

If you have nested data, it can be easier to use salt['pillar.get'], which accepts a single key parameter like key1:key2. E.g. if the pillar data looks like:

    user: fred

you could access the username as:

{{ salt['pillar.get']['apache:user'] }}

instead of:

{{ pillar['apache']['user'] }}

though that would work too.