Issue 1:
ISSUE TYPE

Bug Report

ANSIBLE VERSION

% ansible --version
ansible 2.0.2.0
config file =
configured module search path = Default w/o overrides

This issue is not appeared in ansible 2.0.1.0 or 1.9.6

OS / ENVIRONMENT

mac OS X el capitan 10.11.4

SUMMARY

a comma breaks "changed_when/failed_when" directive

STEPS TO REPRODUCE

- hosts: localhost
gather_facts: no
tasks:
- debug: msg=OK
register: result
changed_when: "100 | random(1,2) == 1"
# changed_when: "100 | random == 1" is OK

EXPECTED RESULTS

TASK [debug] *******************************************************************
ok: [localhost] => {
"msg": "OK"
}

ACTUAL RESULTS

TASK [debug] *******************************************************************
fatal: [localhost]: FAILED! => {"failed": true, "msg": "The conditional check '100 | random(1' failed. The error was: template error while templating string: unexpected '}', expected ')'. String: {% if 100 | random(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 *************************************************************