're-use pillar values in salt(-ssh)

I am currently getting familiar with salt and wonder how I could re-use the values of pillars in other places (sections) in .sls files.

In buildout, I would be able to reference a variable from another section with ${sectionname:varname} to re-use a once defined value. This is especially handy, when dealing with directories (basedir, appdir). buildout example:

['foo']
  path = /highway/to/hell

['bar']
  path = ${foo:path}/lastexit

When I try to reference another variable in an .sls file, even if it is in the same file, I get always None. salt example:

foo:
  path: /highway/to/hell

bar:
  path: {{ salt['pillar.get']('foo:path') }}/lastexit

salt-ssh minion1 pillar.get bar:path results in None/lastexit

I have the feeling, that I'm missing something here. Could someone point out, how one does re-use values in salt .sls



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source