# alternative for loop?

**URL:** <https://forum.ansible.com/t/alternative-for-loop/37285>\
**Category:** Ansible Project\
**Created:** [November 1, 2022, 11:14am UTC](https://forum.ansible.com/t/alternative-for-loop/37285 "2022-11-01T11:14:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [November 1, 2022, 11:14am UTC](https://forum.ansible.com/t/alternative-for-loop/37285/1 "2022-11-01T11:14:32Z")

</div>

Hi

I have a playbook that displays a warning when certain legacy variables are found.  
This works, but I am looking for an alternative that does not involve a looped task.  
My attempt below works only partly, because select(‘defined’) does not work for a nested variable.  
What could be a solution?
