Let's say you have a file named bar.j2 in your templates directory.
/etc/ansible/roles/foo/templates/bar.j2
And let's say bar.j2 contains the following.
{%Y}
Since templates are part of roles, lets say you have a playbook that invokes the foo role.
---
- hosts: all
roles:
- role: foo
And let's say /etc/ansible/roles/foo/tasks/main.yml contains the following.
- name: copy ipv4.j2 to /tmp/ipv4.conf
template:
src: ipv4.j2
dest: /tmp/ipv4.conf
Running this play would return Encounted unknown tag 'Y' because {%Y} is built in jinja2 syntax.
Encounted unknown tag 'Y'
In this scenario, {% raw %} and {% endraw %} are wrapped around the {%Y} built in jinja2 syntax so that {%Y} is not interpreted as jinja2.
{% raw %}{%Y}{% endraw %}