# Latest ansible-core releases forbid templating templates

**URL:** <https://forum.ansible.com/t/latest-ansible-core-releases-forbid-templating-templates/2745>\
**Category:** Project Discussions\
**Tags:** news-for-maintainers\
**Created:** [December 5, 2023, 5:52am UTC](https://forum.ansible.com/t/latest-ansible-core-releases-forbid-templating-templates/2745 "2023-12-05T05:52:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [December 5, 2023, 5:52am UTC](https://forum.ansible.com/t/latest-ansible-core-releases-forbid-templating-templates/2745/1 "2023-12-05T05:52:49Z")

</div>

Some of you might already noticed that CI for some collections started failing since last week Monday. This is due to a breaking change fixing a security issue (CVE-2023-5764):

- [Ensure that unsafe is more difficult to lose [stable-2.16] (#82293) · ansible/ansible@270b39f · GitHub](https://github.com/ansible/ansible/commit/270b39f6ff02511a2199505161218cbd1a5ae34f)
- [Ensure that unsafe is more difficult to lose [stable-2.16] (#82293) · ansible/ansible@270b39f · GitHub](https://github.com/ansible/ansible/commit/270b39f6ff02511a2199505161218cbd1a5ae34f)
- [Ensure that unsafe is more difficult to lose [stable-2.14] (#82295) · ansible/ansible@7239d2d · GitHub](https://github.com/ansible/ansible/commit/7239d2d371bc6e274cbb7314e01431adce6ae25a)

More information can be found in the porting guides:

- [Ansible-core 2.16 Porting Guide — Ansible Core Documentation](https://docs.ansible.com/ansible-core/2.16/porting_guides/porting_guide_core_2.16.html#playbook)
- [Ansible-core 2.15 Porting Guide — Ansible Core Documentation](https://docs.ansible.com/ansible-core/2.15/porting_guides/porting_guide_core_2.15.html#playbook)
- [Ansible-core 2.14 Porting Guide — Ansible Core Documentation](https://docs.ansible.com/ansible-core/2.14/porting_guides/porting_guide_core_2.14.html#playbook)

In collection tests this often affets `ansible.builtin.assert` tasks which use templating. Here are some examples that fixes such conditions. Most are straightfoward to fix:

```diff
   - name: assert container is returned when filters are matched (single label)
     assert:
- that: "{{ output.containers | length }} == 1"
+ that: "output.containers | length == 1"

 - assert:
     that:
       - 'alternative is changed'
- - 'cmd.stdout == "dummy{{ item }}"'
+ - 'cmd.stdout == "dummy" ~ item'

 - assert:
     that:
       - result_basic_2 is not changed
       - result_basic_2 is failed
- - result_basic_2.msg == "Destination {{ non_existing_file }} does not exist!"
+ - result_basic_2.msg == "Destination " ~ non_existing_file ~ " does not exist!"

```

The most complicated I found was the `cmd_runner` integration tests in community.general where the tests themselves including the conditions came from a variable. There it was easiest to use a copy of the `assert` module which loses the unsafe marker: [Fix and re-enable cmd\_runner tests by felixfontein · Pull Request #7630 · ansible-collections/community.general · GitHub](https://github.com/ansible-collections/community.general/pull/7630). Please avoid such solution when possible, and simply fix the conditions to avoid using templating to compose the conditions.
