Using pillar
data in an external PillarStack
Posted by: Mark Bools on 2019-01-28 You are using the The So, instead of: Simply use: See Github issue #13 and associated thread for details. Basically, the native Problem
PillarStack
external pillar in salt
and need to reference a value defined in the standard pillar
data, but salt['pillar.get']
does not work at all (salt
is not defined in the PillarStack
context) and __salt__['pilar.get']
—although defined—returns none
(or the default value specified).Solution
stack pilar
provides generalised recursive access to dictionaries through the __stack__['traverse']
function.1
{{ salt['pillar.get']('some:nested:pillar', 'default') }}
1
{{ __stack__['traverse'](pillar, 'some:nested:pillar', 'default') }}
Discussion
pillar.get
does not work in the context of the PillarStack
system so the author provided and generalised workaround to traverse any available dictionary from Jinja in your PillarStack
data.