# IF/Else-Statement at vars

**URL:** <https://forum.ansible.com/t/if-else-statement-at-vars/46381>\
**Category:** Get Help\
**Tags:** playbook, ansible\
**Created:** [September 30, 2026, 7:32pm UTC](https://forum.ansible.com/t/if-else-statement-at-vars/46381 "2026-09-30T19:32:12Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![kks](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kks/32/10352_2.png) [@kks](https://forum.ansible.com/u/kks)\
**Post date:** [October 1, 2026, 6:57am UTC](https://forum.ansible.com/t/if-else-statement-at-vars/46381/6 "2026-10-01T06:57:46Z")

</div>

> [@bvitnik](#):
>
> The argument being…?

Jinja is a text engine, not all data is text, when something a bit more complex is being used - a lot of problems appear all of the suddent, e.g. jinja spacing issues when you want result to be dict or list. Coertion from text to other data types (implicit in old ansible-core versions, explicit in new versions) is also kind of a problem, I prefer to be sure that I work with “native” data sctructures.

Some more arguments are in this thread

> [@How to solve ansible challenge from ansible-core maintainer](https://forum.ansible.com/t/how-to-solve-ansible-challenge-from-ansible-core-maintainer/45285/1):
>
> This solution I do not like at all. It was very hard to write (I am not a jinja expert), especially get all the ‘-’ right (i had to use AI for that), otherwise result is full of unnecessary spaces. And complete solution falls apart with small changes.

([How to solve ansible challenge from ansible-core maintainer](https://forum.ansible.com/t/how-to-solve-ansible-challenge-from-ansible-core-maintainer/45285))

---

_[View the full topic](https://forum.ansible.com/t/if-else-statement-at-vars/46381)._
