AnsibleError: template error while templating string



Ansible’s Template module is very useful when you want to put variables in the contents of a file.
About how to use Template module, His blog is very easy to understand.  

問題 problem


Template transfer fails with Ansible

TASK [setup-hosts/development/web : Add Template user-setting files] ********
failed: [dev-web] (item={u'owner': u'cron', u'path': u'home/cron/script/', u'group': u'cron', u'mode': u'755'}) => {"changed": false, "item": {"group": "cron", "mode": "755", "owner": "cron", "path": "home/cron/script/"}, "msg": "AnsibleError: template error while templating string: Missing end of comment tag. String: ` '<<<<<'\n"}


Ansible seems to fail if a specific string exists in the file

対処 deal

処理の最初、最後をそれぞれ、“` {% raw %} “` 、“` {% endraw %} “` で挟む。以下のようなイメージ

Insert “` {% raw%}  “` and “` {% endraw%} “` at the beginning and end of processing. The following image

{% raw %}

echo "done"
{% endraw %}