When to quote variables (a YAML gotcha)
If you start a value with{{foo}}, you must quote the whole expression to create valid YAML syntax. If you do not quote the whole expression, the YAML parser cannot interpret the syntax. The parser cannot determine if it is a variable or the start of a YAML dictionary. For guidance on writing YAML, see theYAML Syntaxdocumentation.
If you use a variable without quotes, like this:
You will see:ERROR!SyntaxErrorwhileloadingYAML.If you add quotes, Ansible works correctly: