ansible.builtin.mandatory filter – make a variable’s existance mandatory
Note
This filter plugin is part of ansible-core
and included in all Ansible
installations. In most cases, you can use the short
plugin name
mandatory
.
However, we recommend you use the Fully Qualified Collection Name (FQCN) ansible.builtin.mandatory
for easy linking to the
plugin documentation and to avoid conflicting with other collections that may have
the same filter plugin name.
Synopsis
Depending on context undefined variables can be ignored or skipped, this ensures they force an error.
Input
This describes the input of the filter, the value before | ansible.builtin.mandatory
.
Parameter |
Comments |
---|---|
Mandatory expression. |
Examples
# results in a Filter Error
{{ notdefined | mandatory }}
Return Value
Key |
Description |
---|---|
The input if defined, otherwise an error. Returned: success |
Hint
Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.