I am using a jinja template to generate a state file for salt. I added some conditionals and would like to express:
if A or B
. However, it seems I cannot get any logical operator working.
It doesn't like ||, |, &&
(which I understand doesn't apply here), but also not and, or
and not even grouping with ()
, which should be working according to the jinja documentation. I couldn't find any information on this in the salt docs, but I feel I must be making some stupid mistake?
My code:
{% if grains['configvar'] == 'value' OR grains['configvar'] == 'some other value' %}
Error:
Data failed to compile:
Rendering SLS 'base:mystate' failed: Jinja syntax error: expected token 'end of statement block', got 'OR'; line 3
You are doing it right but the logic operators need to be lower cased.
Try switching all your operators to lower case.