# \[Question\] Jinja2 template - check variable

**URL:** <https://forum.ansible.com/t/question-jinja2-template-check-variable/23783>\
**Category:** Ansible Project\
**Created:** [February 21, 2017, 12:36pm UTC](https://forum.ansible.com/t/question-jinja2-template-check-variable/23783 "2017-02-21T12:36:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![belajzus](https://avatars.discourse-cdn.com/v4/letter/b/df705f/32.png) [@belajzus](https://forum.ansible.com/u/belajzus)\
**Post date:** [February 21, 2017, 12:36pm UTC](https://forum.ansible.com/t/question-jinja2-template-check-variable/23783/1 "2017-02-21T12:36:05Z")

</div>

Hi,

is it possible in Jinja2 template to define possible values for some variable.

Let say I have template config1.j2:

parameter1={{var1 | default(1) }}  
parameter2={{var2 | default(2) }}  
parameter3={{var3 | default(3) }}

So, I would like that to parameter1…3 must be assigned only values 1 or 2 or 3.  
How to achieve that without using “if” statement.

Is it possible somehow to define possible values like is “default” value is defined?
