<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">ANSIBLE VERSION</h5>
<p dir="auto">2.0.2.0</p>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Syntax that worked without a problem in 2.0.1.0 is causing an<br>
templating failure in 2.0.2.0.  Specifically, given this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="until: &quot;result.rc in [1, 2]&quot;"><pre class="notranslate"><code class="notranslate">until: "result.rc in [1, 2]"
</code></pre></div>
<p dir="auto">Ansible says:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="fatal: [localhost]: FAILED! =&gt; {&quot;failed&quot;: true, &quot;msg&quot;: &quot;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 %}&quot;}"><pre class="notranslate"><code class="notranslate">fatal: [localhost]: FAILED! =&gt; {"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 %}"}
</code></pre></div>
<p dir="auto">It appears to be erroneously truncating the condition.  This seems to<br>
be unique to the <code class="notranslate">until:</code> keyword; the same syntax works just fine in,<br>
e.g., a <code class="notranslate">when:</code> statement.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">Run the following playbook:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- hosts: localhost
  gather_facts: false
  tasks:

    - shell: exit $(( RANDOM % 10 ))
      register: result
      until: &quot;result.rc in [1, 2]&quot;
      retries: 10
      delay: 1
      ignore_errors: true"><pre class="notranslate"><code class="notranslate">- 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
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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! =&gt; {&quot;changed&quot;: true, &quot;cmd&quot;: &quot;exit $(( RANDOM % 10 ))&quot;, &quot;delta&quot;: &quot;0:00:00.003918&quot;, &quot;end&quot;: &quot;2016-04-27 11:14:26.891044&quot;, &quot;failed&quot;: true, &quot;rc&quot;: 1, &quot;start&quot;: &quot;2016-04-27 11:14:26.887126&quot;, &quot;stderr&quot;: &quot;&quot;, &quot;stdout&quot;: &quot;&quot;, &quot;stdout_lines&quot;: [], &quot;warnings&quot;: []}
...ignoring

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0   "><pre class="notranslate"><code class="notranslate">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! =&gt; {"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   
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PLAY [localhost] ***************************************************************

TASK [command] *****************************************************************
fatal: [localhost]: FAILED! =&gt; {&quot;failed&quot;: true, &quot;msg&quot;: &quot;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 %}&quot;}
...ignoring

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0   "><pre class="notranslate"><code class="notranslate">PLAY [localhost] ***************************************************************

TASK [command] *****************************************************************
fatal: [localhost]: FAILED! =&gt; {"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   
</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<p dir="auto">interfaces_file</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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)]"><pre class="notranslate"><code class="notranslate">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)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">Host: OS X Python 2.7.12<br>
Target: Cumulus Linux 3.1.1</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">Using the interfaces_file task causes an error: ValueError: need more than 1 value to unpack</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>

<p dir="auto">Install ansible 2.4.0, run the example task shown in interfaces_file documentation.</p>

<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="---
- 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"><pre class="notranslate">---
- <span class="pl-ent">hosts</span>: <span class="pl-s">all</span>
  <span class="pl-ent">become</span>: <span class="pl-c1">true</span>
  <span class="pl-ent">gather_facts</span>: <span class="pl-c1">true</span>

  <span class="pl-ent">tasks</span>:
    - <span class="pl-ent">interfaces_file</span>:
        <span class="pl-ent">dest</span>: <span class="pl-s">/etc/network/interfaces</span>
        <span class="pl-ent">iface</span>: <span class="pl-s">eth1</span>
        <span class="pl-ent">option</span>: <span class="pl-s">mtu</span>
        <span class="pl-ent">value</span>: <span class="pl-c1">8000</span>
        <span class="pl-ent">backup</span>: <span class="pl-s">yes</span>
        <span class="pl-ent">state</span>: <span class="pl-s">present</span>
      <span class="pl-ent">register</span>: <span class="pl-s">eth1_cfg</span></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">I would expect the mtu for eth1 to be changed to 8000.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">An error is raised and the task fails. (This happens for any option. I tested multiple)</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ 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! =&gt; {&quot;changed&quot;: false, &quot;failed&quot;: true, &quot;module_stderr&quot;: &quot;Shared connection to 172.20.116.11 closed.\r\n&quot;, &quot;module_stdout&quot;: &quot;Traceback (most recent call last):\r\n  File \&quot;/tmp/ansible_GxJ8k1/ansible_module_interfaces_file.py\&quot;, line 385, in &lt;module&gt;\r\n    main()\r\n  File \&quot;/tmp/ansible_GxJ8k1/ansible_module_interfaces_file.py\&quot;, line 366, in main\r\n    lines, ifaces = read_interfaces_file(module, dest)\r\n  File \&quot;/tmp/ansible_GxJ8k1/ansible_module_interfaces_file.py\&quot;, line 177, in read_interfaces_file\r\n    return read_interfaces_lines(module, f)\r\n  File \&quot;/tmp/ansible_GxJ8k1/ansible_module_interfaces_file.py\&quot;, 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&quot;, &quot;msg&quot;: &quot;MODULE FAILURE&quot;, &quot;rc&quot;: 0}

PLAY RECAP **********************************************************************************************************************
172.20.116.11              : ok=1    changed=0    unreachable=0    failed=1"><pre class="notranslate"><code class="notranslate">$ 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! =&gt; {"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 &lt;module&gt;\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
</code></pre></div>