diff --git a/lib/ansible/template.py b/lib/ansible/template.py index 3d380b837d..60cdd4f124 100644 --- a/lib/ansible/template.py +++ b/lib/ansible/template.py @@ -187,7 +187,10 @@ def varReplaceWithItems(basedir, varname, vars): if not m: return varname if m['start'] == 0 and m['end'] == len(varname): - return varReplaceWithItems(basedir, m['replacement'], vars) + if m['replacement'] is not None: + return varReplaceWithItems(basedir, m['replacement'], vars) + else: + return varname else: return template(basedir, varname, vars) elif isinstance(varname, (list, tuple)):