Bootstrap FreeKB - Ansible - Resolve "Encountered unknown tag"
Ansible - Resolve "Encountered unknown tag"

Updated:   |  Ansible articles

Let's say you have a template file named my_file.j2.



And let's say my_file.j2 contains the following.



And you have the following playbook which uses templates to copy my_file.j2 to /tmp/my_file.txt on each target server.

- hosts: all
  - name: copy my_file.j2 to /tmp/my_file.txt
      src: /path/to/templates/my_file.j2
      dest: /tmp/my_file.txt


Running this play should return Encounted unknown tag 'Y' because {%Y} is built in jinja2 syntax.

Encounted unknown tag 'Y'


In this scenario, you can wrap {% raw %} and {% endraw %} around the {%Y} built in jinja2 syntax so that {%Y} is not interpreted as jinja2.

{% raw %}{%Y}{% endraw %}


Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee


July 23 2021 by Steve
This helped me out with an issue with the www.conf file of PHP-FPM which had %Y in the comments of some settings.

Add a Comment

Please enter cb0ca3 in the box below so that we can be sure you are a human.