0

On the SaltStack documentation: It is explained that:

'node_type:web':
  - match: grain
  - webserver

'node_type:postgres':
  - match: grain
  - database

'node_type:redis':
  - match: grain
  - redis

'node_type:lb':
  - match: grain
  - lb

Can be simplified in:

{% set node_type = salt['grains.get']('node_type', '') %}

{% if node_type %}
  'node_type:{{ self }}':
    - match: grain
    - {{ self }}
{% endif %}

Using Jinja2 templating system (if the 'node_type' grain variable has been set on the minion). I don't understand to what {{ self }} refers? Where does this variable come from?

MarAja
  • 203
  • 3
  • 6
  • "self" should be "node_type". I looked at the documentation again today (pointing to the 2015.8.0 version) or looking at the version on trunk on github https://github.com/saltstack/salt/blob/666108df17569bdd17a1fba333a863b97197ef2e/doc/topics/targeting/grains.rst it has already been corrected. – ahus1 Sep 04 '15 at 19:03
  • Right, seems more logical now :) – MarAja Sep 08 '15 at 12:16

0 Answers0