Reputation: 9945
I could not find a clear reference for that - is it possible to refer to one pillar value in another pillar value?
one: Hello
two: {{ one }} world # This syntax is invalid
I tried {{ one }}
and {{ pillar['one'] }}
but both fail. Is it possible to achieve it at all in some way?
Upvotes: 2
Views: 1188
Reputation: 4418
I don't think you can do it directly, but you can make a variable and reference it in multiple places:
{%- set value = "Hello" %}
one: {{ value }}
two: {{ value }} world
Not what you asked for, but maybe close to what you wanted, if what you were really looking for was a single point of truth.
This also works, and is useful for multiple vars:
{%- load_yaml as vars %}
var1: something
var2: else
{%- endload %}
one: {{ vars.var1 }}
two: {{ vars.var2 }}
three: {{ vars.var1 }}
# and so on
Both cases create a jinja variable that isn't pillar data in itself, but can be used to define pillar data.
Upvotes: 4