Issue 1:
ISSUE TYPE

Bug Report

ANSIBLE VERSION

2.0.2.0

CONFIGURATION

N/A

OS / ENVIRONMENT

N/A

SUMMARY

Syntax that worked without a problem in 2.0.1.0 is causing an

templating failure in 2.0.2.0. Specifically, given this:

until: "result.rc in [1, 2]"

Ansible says:

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

It appears to be erroneously truncating the condition. This seems to

be unique to the until: keyword; the same syntax works just fine in,

e.g., a when: statement.

STEPS TO REPRODUCE

Run the following playbook:

- hosts: localhost
gather_facts: false
tasks:

- shell: exit $(( RANDOM % 10 ))
register: result
until: "result.rc in [1, 2]"
retries: 10
delay: 1
ignore_errors: true

EXPECTED RESULTS

PLAY ***************************************************************************

TASK [command] *****************************************************************
FAILED - RETRYING: TASK: command (9 retries left). Result was: {u'changed': True, u'end': u'2016-04-27 11:14:21.288652', u'stdout': u'', u'cmd': u'exit $(( RANDOM % 10 ))', u'rc': 0, u'start': u'2016-04-27 11:14:21.285226', u'stderr': u'', u'delta': u'0:00:00.003426', 'invocation': {'module_name': u'command', u'module_args': {u'creates': None, u'executable': None, u'chdir': None, u'_raw_params': u'exit $(( RANDOM % 10 ))', u'removes': None, u'warn': True, u'_uses_shell': True}}, 'stdout_lines': [], u'warnings': []}
fatal: [localhost]: FAILED! => {"changed": true, "cmd": "exit $(( RANDOM % 10 ))", "delta": "0:00:00.003918", "end": "2016-04-27 11:14:26.891044", "failed": true, "rc": 1, "start": "2016-04-27 11:14:26.887126", "stderr": "", "stdout": "", "stdout_lines": [], "warnings": []}
...ignoring

PLAY RECAP *********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0

ACTUAL RESULTS

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

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

PLAY RECAP *********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0

Issue 2:
ISSUE TYPE

Bug Report

COMPONENT NAME

interfaces_file

ANSIBLE VERSION

ansible 2.4.0.0
config file = /Users/bwatson/Projects/[removed]/ansible.cfg
configured module search path = [u'/Users/bwatson/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /Users/bwatson/Projects/[removed]/venv/lib/python2.7/site-packages/ansible
executable location = /Users/bwatson/Projects/[removed]/venv/bin/ansible
python version = 2.7.12 (default, Jun 29 2016, 14:05:02) [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]

CONFIGURATION

OS / ENVIRONMENT

Host: OS X Python 2.7.12

Target: Cumulus Linux 3.1.1

SUMMARY

Using the interfaces_file task causes an error: ValueError: need more than 1 value to unpack

STEPS TO REPRODUCE

Install ansible 2.4.0, run the example task shown in interfaces_file documentation.

---
- hosts: all
become: true
gather_facts: true

tasks:
- interfaces_file:
dest: /etc/network/interfaces
iface: eth1
option: mtu
value: 8000
backup: yes
state: present
register: eth1_cfg

EXPECTED RESULTS

I would expect the mtu for eth1 to be changed to 8000.

ACTUAL RESULTS

An error is raised and the task fails. (This happens for any option. I tested multiple)

$ ansible-playbook interfaces_test.yml -i 172.20.116.11, -u admin -vv
ansible-playbook 2.4.0.0
config file = /Users/bwatson/Projects/[removed]/ansible.cfg
configured module search path = [u'/Users/bwatson/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /Users/bwatson/Projects/[removed]/venv/lib/python2.7/site-packages/ansible
executable location = /Users/bwatson/Projects/[removed]/venv/bin/ansible-playbook
python version = 2.7.12 (default, Jun 29 2016, 14:05:02) [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]
Using /Users/bwatson/Projects/[removed]/ansible.cfg as config file

PLAYBOOK: interfaces_test.yml ***************************************************************************************************
1 plays in interfaces_test.yml

PLAY [all] **********************************************************************************************************************

TASK [Gathering Facts] **********************************************************************************************************
ok: [172.20.116.11]
META: ran handlers

TASK [interfaces_file] **********************************************************************************************************
task path: /Users/bwatson/Projects/[removed]/interfaces_test.yml:17
fatal: [172.20.116.11]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Shared connection to 172.20.116.11 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible_GxJ8k1/ansible_module_interfaces_file.py\", line 385, in <module>\r\n main()\r\n File \"/tmp/ansible_GxJ8k1/ansible_module_interfaces_file.py\", line 366, in main\r\n lines, ifaces = read_interfaces_file(module, dest)\r\n File \"/tmp/ansible_GxJ8k1/ansible_module_interfaces_file.py\", line 177, in read_interfaces_file\r\n return read_interfaces_lines(module, f)\r\n File \"/tmp/ansible_GxJ8k1/ansible_module_interfaces_file.py\", line 211, in read_interfaces_lines\r\n iface_name, address_family_name, method_name = words[1:4]\r\nValueError: need more than 1 value to unpack\r\n", "msg": "MODULE FAILURE", "rc": 0}

PLAY RECAP **********************************************************************************************************************
172.20.116.11 : ok=1 changed=0 unreachable=0 failed=1