Erroring on undefined variables

All:

I just submitted a pull request with a new option fails a task if its arguments contain undefined variables.

https://github.com/ansible/ansible/pull/3066

If there’s interest in this type of functionality, in the future I’d like to add support for checking templates and a command-line switch for enabling (currently the option can only be set by configuration file or environment variable).

Lorin

Thanks for this. I like this idea of having this capability.

The check for undefined variables seems a little sketchy for me because it looks for “{{” where it should be doing Jinja2 things at the last possible instant to see if Jinja2 expressions cause undefined errors.

The example.cfg should also mention this as this is what the RPM lays down so people don’t have to look in the code to figure out what the variables are. It should be off by default to coincide with current behavior.

It should also be made to work for templates at the same time so we don’t accept a patch half implemented.

Aka there can’t be a “in the future”, they need to come together :slight_smile:

I also do not want a command line switch added, seems unneeded.