# Replacing WITH\_SUBELEMENTS loop with 2.5 new syntax

**URL:** <https://forum.ansible.com/t/replacing-with-subelements-loop-with-2-5-new-syntax/27411>\
**Category:** Ansible Project\
**Created:** [April 30, 2018, 1:25pm UTC](https://forum.ansible.com/t/replacing-with-subelements-loop-with-2-5-new-syntax/27411 "2018-04-30T13:25:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aetbnpp](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@aetbnpp](https://forum.ansible.com/u/aetbnpp)\
**Post date:** [April 30, 2018, 1:25pm UTC](https://forum.ansible.com/t/replacing-with-subelements-loop-with-2-5-new-syntax/27411/1 "2018-04-30T13:25:09Z")

</div>

Hello all,

I’m trying to update my playbooks with the simplified LOOP new syntax, every went well until I tried to remove WITH\_SUBELEMENTS loops. My dictionary looks like this

soft:

- version: X.X.X.X  
options:
- command: “something”
- command: “something”
- command: “something”
- command: “something”

I need to reference the version key whille looping against options command list and I can’t figure out how to do this using loop: “{{ query(‘subelements’, soft, ‘options’, skip\_missing=True’) }}” ?

Below is the old loop:

command: do something item[1].command “item[0].version”  
with\_subelements:

- “{{ soft }}”
- options

Any clue? Thanks by advance
