# Create and add to a multi field array

**URL:** <https://forum.ansible.com/t/create-and-add-to-a-multi-field-array/33186>\
**Category:** Ansible Project\
**Created:** [June 15, 2020, 2:59pm UTC](https://forum.ansible.com/t/create-and-add-to-a-multi-field-array/33186 "2020-06-15T14:59:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicholas\_Britton](https://avatars.discourse-cdn.com/v4/letter/n/a587f6/32.png) [@Nicholas\_Britton](https://forum.ansible.com/u/Nicholas_Britton)\
**Post date:** [June 15, 2020, 2:59pm UTC](https://forum.ansible.com/t/create-and-add-to-a-multi-field-array/33186/1 "2020-06-15T14:59:59Z")

</div>

I am trying to find away that i can create an array that i can reference later that would be built through a series of include\_task plays. Through the plays i will specific pieces of data that i care to keep for use later.

My layout is as:

main.yml  
– inlcude\_tasks.yml with loop  
– include\_task statements (3)

So i have a main playbook, that has a include\_tasks play that is calling another task list that is then calling three more include\_tasks. I am doing it this way to as i loop through each item at the main.yml play i am able to work with a single dataset through each uri call to keep passing key data.

When i am done with the last include\_task i would like to add 6 vars that i care about to a single array so i can reference them later.

Something like : group, type, asset, location, etc.

This would be something i would loop through to do more stuff later.

Thoughts??

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [June 15, 2020, 4:09pm UTC](https://forum.ansible.com/t/create-and-add-to-a-multi-field-array/33186/2 "2020-06-15T16:09:45Z")

</div>

Hi

The question is a bit abstract - can you provide some more tangible  
code/playbooks/data?

---

<div class="post-metadata">

**Author:** ![Nicholas\_Britton](https://avatars.discourse-cdn.com/v4/letter/n/a587f6/32.png) [@Nicholas\_Britton](https://forum.ansible.com/u/Nicholas_Britton)\
**Post date:** [June 16, 2020, 6:26am UTC](https://forum.ansible.com/t/create-and-add-to-a-multi-field-array/33186/3 "2020-06-16T06:26:44Z")

</div>

I dont have much data at the moment since I am using a few test playbooks with static set vars to see if nested include task statements would work. Which it did. The part I am missing is after the nested includes that run in a loop, I want to print a summary of specifc vars to the screen for confirmation to the user running the playbook.
