Ansible template for loop any given number of iterations

I am running a for lo0p in creating file via ansible template.

If I hard code my loop count everything works fine.

{% for x in range(0,3) %}
Value of x is : {{x}}
{% endfor %}

But as I give dinamic value it gives error

{% for x in range(0,{{count}}) %}
Value of x is : {{x}}
{% endfor %}

fatal: [localhost] => {‘msg’: “file: ~/playbook.yml, line number: 23, error: expected token ‘:’, got ‘}’”, ‘failed’: True},

Any suggestion please.

you are ‘overtemplating’, you don’t need {{}} inside {% %}​