The problem is with the way you set your 'vars' up.  You probably want:

vars:
    a: yes
    b: yes

Starting a line with a '-' tells it that you are defining a list.  However in 
this specific case, it just ignores the definition of 'b'.  So due to your vars 
not actually being defined you get 'error while evaluating conditional: a and b'
-- 
Matt Martz
[email protected]

On December 30, 2013 at 9:33:25 AM, Joost Cassee ([email protected]) wrote:

Hi,

This is probably a very silly mistake on my part, but I cannot seem to get 
con-/disjunctions working in when statements. See this setup:

hosts:
---
localhost
---

playbook.yml:
---
---
- hosts: localhost
  gather_facts: no
  connection: local
  vars:
  - a: yes
    b: yes
  tasks:
  - action: ping
    when: a and b
---

Running the playbook:
---
$ ansible-playbook playbook.yml -i hosts

PLAY [localhost] ************************************************************** 

TASK: [ping] ****************************************************************** 
fatal: [localhost] => error while evaluating conditional: a and b

FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/home/joost/playbook.retry

localhost                  : ok=0    changed=0    unreachable=1    failed=0   
---

What am I missing?

Regards,
Joost
--
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].
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to