Is it possible to force Ansible when replacing the var in yml files, which is undefined, throw out an error instead silently replaced by an empty string?
Is it possible to force Ansible when replacing the var in yml files, which is undefined, throw out an error instead silently replaced by an empty string?
Yes, it is possible. Check the online documentation, under accessing complex variable data.
An example is provided to do exactly that:
Add this line to the
[defaults]
section of your ansible.cfg:You'll now get an error message if a variable is undefined.
Define your variables in
like:
and then do in
like:
You can use mandatory-values