I have this piece of code that checks if the variable "owner" matches with the following regex and accepts that it is undefined, that is, the playbook can work without that variable being passed.
varexample is undefined or varexample is match('^[a-zA-Z]+$')
What I would like to do is that this variable accepts empty or null values. What I tried is something like this
varexample is null or varexample is match('^[a-zA-Z]+$')
But I got this error:
The conditional check 'varexample is null or varexample is match('[a-zA-Z]+')' failed. The error was: template error while templating string: no test named 'null'. String: {% if varexample is null or varexample is match('[a-zA-Z]+') %} True {% else %} False {% endif %}
Can someone give me a hint or some help?