Issue 1:
ISSUE TYPE

Bug Report

ANSIBLE VERSION

ansible 2.0.2.0
config file = /home/gross/experiments/ansible-bug/ansible.cfg
configured module search path = Default w/o overrides

CONFIGURATION

System /etc/ansible/ansible.cfg isn't changed.

/home/gross/experiments/ansible-bug/ansible.cfg:

[defaults]
hostfile = servers

servers:

localhost ansible_python_interpreter=/usr/bin/python2

OS / ENVIRONMENT

ArchLinux x86_64, python 2.7.11 (at /usr/bin/python2)

SUMMARY

Ansible fails when playbook contains failed_when with not in [...] with more than 1 element in list.

STEPS TO REPRODUCE

Run ansible-playbook site.yml

---

- hosts:
- localhost
tasks:
- shell: /bin/false
register: res
failed_when: res.rc not in [0,2]
- debug: msg={{ res }}

EXPECTED RESULTS

ansible-playbook finishes without a error.

ACTUAL RESULTS

ansible-playbook error:

TASK [command] *****************************************************************
fatal: [localhost]: FAILED! => {"failed": true, "msg": "The conditional check 'res.rc not in [1' failed. The error was: template error while templating string: unexpected '}', expected ']'. String: {% if res.rc not in [1 %} True {% else %} False {% endif %}"}

Issue 2:
ISSUE TYPE

Bug Report

ANSIBLE VERSION

ansible 2.0.2.0
config file = /home/sfox/.ansible.cfg
configured module search path = /home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/library

CONFIGURATION

library = /home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/library
forks = 20
sudo_flags = -H -i
jinja2_extensions = jinja2.ext.do,jinja2.ext.i18n,jinja2.ext.loopcontrols,jinja2.ext.with_
ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
action_plugins = /usr/share/ansible_plugins/action_plugins:/home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/plugins/action
callback_plugins = /usr/share/ansible_plugins/callback_plugins:/home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/plugins/callback
connection_plugins = /usr/share/ansible_plugins/connection_plugins:/home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/plugins/connection
lookup_plugins = /usr/share/ansible_plugins/lookup_plugins:/home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/plugins/lookup
vars_plugins = /usr/share/ansible_plugins/vars_plugins:/home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/plugins/vars
filter_plugins = /usr/share/ansible_plugins/filter_plugins:/home/sfox/src/sysops/ops/branches/ansible-2.0/ansible/plugins/filter
nocows = 1

OS / ENVIRONMENT

From: Fedora 23

Managing: Ubuntu Trusty (14.04)

SUMMARY

I can no longer specify lists or tuples in a failed_when statement like I could with 1.9.x

STEPS TO REPRODUCE

Using this inventory file

test_host ansible_host=10.0.0.208

and this playbook

- name: My Playbook
hosts: test_host
gather_facts: no

tasks:
- shell: ls pants
register: result
failed_when: result.rc not in [0, 1]
#failed_when: "result.rc not in [0, 1]"
#failed_when: result.rc not in (0, 1)

I cannot get Ansible to execute this with or without quotes. Both lists and tuples worked previously.

EXPECTED RESULTS

PLAY [My Playbook] ************************************************************

TASK: [shell ls pants] ********************************************************
failed: [test_host] => {"changed": true, "cmd": "ls pants", "delta": "0:00:00.003004", "end": "2016-04-05 16:29:21.478688", "failed": true, "failed_when_result": true, "rc": 2, "start": "2016-04-05 16:29:21.475684", "stdout_lines": [], "warnings": []}
stderr: ls: cannot access pants: No such file or directory

FATAL: all hosts have already failed -- aborting

ACTUAL RESULTS

PLAY [My Playbook] *************************************************************

TASK [command] *****************************************************************
fatal: [test_host]: FAILED! => {"failed": true, "msg": "The conditional check 'result.rc not in [0' failed. The error was: template error while templating string: unexpected '}', expected ']'. String: {% if result.rc not in [0 %} True {% else %} False {% endif %}"}

NO MORE HOSTS LEFT *************************************************************