Defining mandatory values
If you configure Ansible to ignore undefined variables, you may want to define some values as mandatory. By default, Ansible fails if a variable in your playbook or command is undefined. You can configure Ansible to allow undefined variables by settingDEFAULT_UNDEFINED_VAR_BEHAVIORtofalse. In that case, you may want to require some variables to be defined. You can do this with:
The variable value will be used as is, but the template evaluation will raise an error if it is undefined.
A convenient way of requiring a variable to be overridden is to give it an undefined value using theundef()function.