Strange behaviour with a wrong conditional

8 views
Skip to first unread message

Johannes Kastl

unread,
Mar 9, 2016, 3:28:22 PM3/9/16
to ansible...@googlegroups.com
Evening everybody,

I just noticed something strange:

My playbook contains:
------------------
vars:
lxc_version: 2.0
------------------

In the role, that is being called in the playbook, I had the following:
------------------
- name: debug
debug: msg="When lxc_version is 1.0"
when: lxc_version == "1.0"

- name: delete file
file:
dest=/some/path
state=absent
when: lxc_version == "1.0"
------------------

So, both tasks should be skipped, as the conditional is written in a
wrong way: 1.0 is recognized as a number, thus does not need to be
quoted. At least that's how I try to explain it. Feel free to correct
me...

BUT:

Only the debug task is shown as skipped, the file task is shown as
'not changed' but run (green instead of light blue on my machine).

If I change the lines to "when: lxc_version == 1.0" (without the
quoted 1.0), both tasks are shown as skipped.

Is this expected? I would have thought that skipped tasks are really
skipped and should thus be shown as such.

No?

Thanks,
Johannes

signature.asc
Reply all
Reply to author
Forward
0 new messages