Playbooks must be valid YAML, so, quotes are needed since you cannot start a YAML string with a curly brace ‘{’ character, because that character is used to define YAML dictionaries. If you were to use the var in the middle of a string though you would not need to use quotes. For example, the following syntax is correct: welcome_message: Hello {{ name }}
newrelic``_license_key``: null newrelic_environment: null newrelic: no
And if I need to test if there is need to install newrelic on a server I need to write this:
when: newrelic and newrelic_license_key is not none and newrelic_environment is not none
I would prefer to do this:
newrelic``_license_key``: null
```newrelic_environment: nullnewrelic: nouse_newrelic: {{ ``newrelic and newrelic_license_key is not none and newrelic_environment is not none }}`
And then use use_newrelic in all conditional statements.
There is a workaround for this: wrap use_newrelic value to quotes and then check it in that way: use_newrelic == "True"