On 23.03.2014 12:42, Arie Skliarouk wrote:
The following playbook does not work properly - the action is always
executed, why is that?
---
- hosts: *
vars:
x: 5
y: 7
is_false1: x>y
is_false2: x>y
Here you set is_false1 and is_false2 to strings "x>y", not to a result
of evaluating it (and it would be the same if you put {{ }} around it)
tasks:
- name: either is true
shell: echo either is true
when: is_false1 or is_false2
And here you check if either is_false1 or is_false2 is true-like - which
they both are, as they are non-empty strings. What would work is putting
them in {{ }} like this:
when: '{{ is_false1 }} or {{ is_false2 }}'
which looks bad, and tells you about {{ }} not being needed (which is
not true in this case...).
--
You received this message because you are subscribed to the Google Groups "Ansible
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/532EDC0D.9040803%40gmail.com.
For more options, visit https://groups.google.com/d/optout.