Hi,
is it possible to use a composite “when” expression in Ansible 1.2.2?
I’ve been trying to make a conditional task based on 2 conditions, one is a variable defined in the inventory file just for one machine, and the other one is the result of a shell module (check if the return value is not an empty string)
when: $IS_MASTER and pid_list.stdout != ‘’
But I’m getting this result:
TASK: [-----------] **********************
fatal: [xxx.xx.xx.103] => Conditional expression must evaluate to True or False: {% if True and pid_list.stdout != ‘’ %} True {% else %} False {% endif %}
fatal: [xxx.xx.xx.104] => Conditional expression must evaluate to True or False: {% if False and pid_list.stdout != ‘’ %} True {% else %} False {% endif %}
If I use only one expression, it works fine: when: $pid_list.stdout != ‘’
I cannot afford in this moment to migrate to a newer version of Ansible.
Thanks in advance.
Jean Paul Manjarres Correal.