# Ansible - Dynamic List Creation

**URL:** <https://forum.ansible.com/t/ansible-dynamic-list-creation/27133>\
**Category:** Ansible Developer\
**Created:** [March 27, 2018, 5:49pm UTC](https://forum.ansible.com/t/ansible-dynamic-list-creation/27133 "2018-03-27T17:49:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohammed\_Yasar\_Aktha](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@Mohammed\_Yasar\_Aktha](https://forum.ansible.com/u/Mohammed_Yasar_Aktha)\
**Post date:** [March 27, 2018, 5:49pm UTC](https://forum.ansible.com/t/ansible-dynamic-list-creation/27133/1 "2018-03-27T17:49:45Z")

</div>

I have a list, based on the index value need to generate a new list  
Here is the sample

```auto
- set_fact: buildslen={{ builds | length }}
- debug: var=exactlen

```

```auto
- set_fact: upg_version_list2={{ upg_version_list2|default([]) + builds + [item] }}
  with_sequence: start={{ exactlen }} end={{ buildslen }}

```

The problem is the list not getting generated based on the indexes. Any suggestions to resolve this issue
