I'm currently porting my Ansible playbooks from version 2.1 to 2.7. Ansible now prints a warning if I use jinja templating delmiters such as {{ .. }} in a when clause.
[WARNING]: when statements should not include jinja2 templating delimiters such as {{ }} or {% %}
I had no problems to change it on simple conditionals statements, but I wonder how to fix this one:
- shell: pg_lsclusters -h | awk '{print $2 " " $6}'
register: postgresql_lsclusters
changed_when: false
check_mode: no
- fail:
msg="test"
when: postgresql_lsclusters.stdout.find("{{ postgresql_cluster }} {{ postgresql_data_dir }}/{{ postgresql_version }}/{{ postgresql_cluster }}") == -1
I tried to replace the when statement with the following, without success:
when: postgresql_lsclusters.stdout.find(postgresql_cluster ~ ' ' ~ postgresql_data_dir ~ '/' ~ postgresql_version ~ '/' ~ postgresql_cluster") == -1`