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?