Create and add to a multi field array

13 views
Skip to first unread message

Nicholas Britton

unread,
Jun 15, 2020, 10:59:59 AM6/15/20
to Ansible Project
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??

Dick Visser

unread,
Jun 15, 2020, 12:10:19 PM6/15/20
to ansible...@googlegroups.com
Hi

The question is a bit abstract - can you provide some more tangible
code/playbooks/data?
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1a580898-9548-4410-bf6e-6e132ca9effeo%40googlegroups.com.



--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

Nicholas Britton

unread,
Jun 16, 2020, 2:26:44 AM6/16/20
to Ansible Project
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.
Reply all
Reply to author
Forward
0 new messages