when: behaviour changed in 1.3

This works in 1.2.2


  • hosts: lh

vars:

with_echo: True

tasks:

  • debug: msg=“This works in 1.2.2”

when: with_echo

Same playbook in 1.3 gives me

TASK: [debug msg=“This works in 1.2.2”] ***************************************
fatal: [127.0.0.1] => Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/ansible/runner/init.py”, line 367, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File “/usr/local/lib/python2.7/dist-packages/ansible/runner/init.py”, line 451, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File “/usr/local/lib/python2.7/dist-packages/ansible/runner/init.py”, line 532, in _executor_internal_inner
if not utils.check_conditional(cond, self.basedir, inject, fail_on_undefined=self.error_on_undefined_vars):
File “/usr/local/lib/python2.7/dist-packages/ansible/utils/init.py”, line 167, in check_conditional
presented = “{% if " + conditional + " %} True {% else %} False {% endif %}”
TypeError: cannot concatenate ‘str’ and ‘bool’ objects

How can I do this logic in 1.3?

– Frans

I have an outstanding pull request to deal with this on the development branch.

It will be tested/merged very soon, though I had some reservations about how it handled Unicode so I didn’t immediately merge it (needed further testing).

I believe

with_echo == True

is functional as a temporary fix.