# Simple task breaks with version 2.0.2.0

**URL:** <https://forum.ansible.com/t/simple-task-breaks-with-version-2-0-2-0/21220>\
**Category:** Ansible Project\
**Created:** [April 20, 2016, 2:32pm UTC](https://forum.ansible.com/t/simple-task-breaks-with-version-2-0-2-0/21220 "2016-04-20T14:32:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jurgen\_Haas2](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@Jurgen\_Haas2](https://forum.ansible.com/u/Jurgen_Haas2)\
**Post date:** [April 20, 2016, 2:32pm UTC](https://forum.ansible.com/t/simple-task-breaks-with-version-2-0-2-0/21220/1 "2016-04-20T14:32:35Z")

</div>

The task is this:

`

```auto
- name: "Check Ansible version"
  run_once: true
  debug: msg="You need at least version 2.0.0.0, currently using version {{ ansible_version.full }}"
  failed_when: "{{ ansible_version.full | version_compare('2.0.0.0', operator='lt', strict=False)}}"

```

`

The error message doesn’t ring a bell, it worked in 2.0.1.0:

`The conditional check '{{ ansible_version.full|version_compare(\"2.0.0.0\" ' failed. The error was: template error while templating string: unexpected end of template, expected ','.. String: {{ ansible_version.full|version_compare(\"2.0.0.0\" "}`

Any idea what’s wrong with it?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [April 20, 2016, 4:09pm UTC](https://forum.ansible.com/t/simple-task-breaks-with-version-2-0-2-0/21220/2 "2016-04-20T16:09:17Z")

</div>

First `​always use moustaches except when when:​`, you are stringifying/templating/stringifying/templating, this can lead to unexpected errors, just write it this way:

failed\_when: ansible\_version.full | version\_compare(‘2.0.0.0’, operator=‘lt’, strict=False)

---

<div class="post-metadata">

**Author:** ![Jurgen\_Haas2](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@Jurgen\_Haas2](https://forum.ansible.com/u/Jurgen_Haas2)\
**Post date:** [April 21, 2016, 6:50am UTC](https://forum.ansible.com/t/simple-task-breaks-with-version-2-0-2-0/21220/3 "2016-04-21T06:50:43Z")

</div>

Well, when I do

```auto
failed_when: ansible_version.full | version_compare('2.0.0.0', operator='lt', strict=False)

I'll get this error:

The error was: template error while templating string: unexpected '}', expected ')'. String: {% if ansible_version.full|version_compare('2.0.0.0' %} True {% else %} False {% endif %}"}

```

---

<div class="post-metadata">

**Author:** ![Jurgen\_Haas2](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@Jurgen\_Haas2](https://forum.ansible.com/u/Jurgen_Haas2)\
**Post date:** [April 21, 2016, 7:16am UTC](https://forum.ansible.com/t/simple-task-breaks-with-version-2-0-2-0/21220/4 "2016-04-21T07:16:17Z")

</div>

Also, I’d suggest to update the documentation at [http://docs.ansible.com/ansible/playbooks\_filters.html#version-comparison-filters](http://docs.ansible.com/ansible/playbooks_filters.html#version-comparison-filters) about this too, because this is where I got it from.

---

<div class="post-metadata">

**Author:** ![Jurgen\_Haas2](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@Jurgen\_Haas2](https://forum.ansible.com/u/Jurgen_Haas2)\
**Post date:** [April 25, 2016, 6:21am UTC](https://forum.ansible.com/t/simple-task-breaks-with-version-2-0-2-0/21220/5 "2016-04-25T06:21:29Z")

</div>

Has anyone else had this issue as well? Looks to be that version\_compare() is completely broken. @Brian, what about the follow up issue when removing some of the wrappers like suggested?

---

<div class="post-metadata">

**Author:** ![Jurgen\_Haas2](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@Jurgen\_Haas2](https://forum.ansible.com/u/Jurgen_Haas2)\
**Post date:** [April 25, 2016, 9:43am UTC](https://forum.ansible.com/t/simple-task-breaks-with-version-2-0-2-0/21220/6 "2016-04-25T09:43:52Z")

</div>

Also reported this in the issue queue: [https://github.com/ansible/ansible/issues/15572](https://github.com/ansible/ansible/issues/15572)

Looks like there is a broader issue.
