Reputation: 5740
My goal is to use a conditional check, on two variables, using the or
operator in Ansible.
I've configured 2 variables:
var1: test_var
var2: another_var
I'm using one a check on one variable works.
when: "'te' in var1" # works!
But using two variables is always true.
when: "'te' in var1 or var2" # True
when: "'xxx' in var1 or var2" # Also true, but I expect false
when: "'xxx' in var1" or "'xxx' in var2" # syntax error
What am I doing wrong?
Upvotes: 8
Views: 11303
Reputation: 5740
Got it.
when: "'xxx' in var1 or 'te' in var2"
I had to ensure I was using proper quoting.
Upvotes: 11