diff --git a/lib/ansible/utils/template.py b/lib/ansible/utils/template.py index 919436895a9..a58b9399715 100644 --- a/lib/ansible/utils/template.py +++ b/lib/ansible/utils/template.py @@ -184,8 +184,7 @@ class _jinja2_vars(object): var = self.vars[varname] # HostVars is special, return it as-is, as is the special variable # 'vars', which contains the vars structure - if type(var) == str: - var = to_unicode(var) + var = to_unicode(var, nonstring="passthru") if isinstance(var, dict) and varname == "vars" or isinstance(var, HostVars): return var else: