Ansible provides an internal data type for declaring variable values as “unsafe”. This means that the data held within the variables value should be treated as unsafe preventing unsafe character subsitition and information disclosure.

Jinja2 contains functionality for escaping, or telling Jinja2 to not template data by means of functionality such as {%raw%}...{%endraw%}, however this uses a more comprehensive implementation to ensure that the value is never templated.

Using YAML tags, you can also mark a value as “unsafe” by using the !unsafe tag such as: