saltstack/salt — Issue #739: custom grains don't work in jinja
Author: pille
Created: 2012-02-22 13:10:05+00:00
State: open

in a jinja2-template (for redis) i want to enable master-slave config out of custom grains info, i defined in
/etc/salt/roles:

grains:
redis-master-queue-host: redis-server.example.com
redis-master-queue-port: 10004

{% if grains['redis-master-queue-host'] %}
slaveof {{ grains['redis-master-queue-host'] }} {{ grains['redis-master-queue-port'] }}
{% endif %}

unfortunately the values don't get substituted. it even looks like my custom defined grains are not valid inside jinja.
if i include a {{ grains |pprint }} inside my template, it contains only system grains.