How to make mandatory variables if variable is defined

Hi, I want to make sure before execution of the role that if a variable is defined you have to define another variables, can I do that?

I have a template:

{% if variable1 != ‘’ %}
variable1 = {{ variable1 }}
variable2 = {{ variable2 }}
variable3 = {{ variable3 }}
{% endif %}

How to make mandatory variable2 and variable3 if variable1 is defined?

- assert:
       that:
         - variable2 is defined
         - variable3 is defined
     when: variable1 is defined