-
Notifications
You must be signed in to change notification settings - Fork 23.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add a "fail" filter #69255
Comments
Files identified in the description: If these files are incorrect, please update the |
Is there a reason you couldn't just use the mandatory filter? Don't define the var at all, but you can put a comment like:
And then in your task use:
|
Thanks for your reply. That's basically how we are doing it now, but I think this approach has some drawbacks:
|
This would be the filter equivalent of the |
What about extending the # the password for the mysql root user.
# this password is used in several roles (like monitoring, application setup, etc.)
# required, generate with pwgen -s 20
global_mysql_root_password: or any of the null YAML specifiers like global_mysql_root_password: ~
global_mysql_root_password: null |
closing as per #75407 |
SUMMARY
Add a "fail" filter that always returns a FilterError with a specific message.
ISSUE TYPE
COMPONENT NAME
core filters
ADDITIONAL INFORMATION
I would like to list and document all variables. Role specific variables could be listed and documented in "roles/*/defaults/*" and global variables in "group_vars/all/global.yml". Unfortunately there are some variables which do not have a good default value. For example, setting a variable like "mysql_password" to an empty string might be fatal. Sure, I could assert at the start of every role that the variable is not empty, but the chances are high that I might forget to add the assert on one place or another. Therefore, something like the following would be nice:
group_vars/all/global.yml:
If I then happen to forget to override the variable somewhere, an error like "failed to render global_mysql_root_password: required, generate with pwgen -s 20" is thrown.
The filter is easy to write (I can provide a PR if you want), is less specific than several other filters already present (e.g. "debug_type") and might be useful in a lot of places.
The text was updated successfully, but these errors were encountered: