List in lists

12 views
Skip to first unread message

Mikael Sandström

unread,
Mar 8, 2017, 3:57:15 AM3/8/17
to Ansible Project
Hi,


I've got a structure like this:

     blergh:
       
- parent: first_layer
          first_layer_list
:
               
- { name: first_layer_list_1st_name }
               
- { name: first_layer_list_2nd_name }
          child
:
               
- name: second_layer
                 second_layer_list
:
                     
- {name: second_layer_list_1st_name}
                     
- {name: second_layer_list_2nd_name}





I want to access the elements in the second_layer_list, but not sure if that is possible.

I can access the 'child.name', with no problems (using with_subelements), but I'm not sure how to get deeper into the structure.


The whole point of the structure is that you can have x number of  'parent' with y number of o names (first_layer_list). It is also possible to have x number of  'child' within the parent which in turn also can have x number of names (second_layer_list)


One option could be to move 'child' to its own list (like blergh) and 'join' child.name  to blergh.parent key, but I'd rather keep it in the same structure if possible.

Any ideas?

regards
/M


Reply all
Reply to author
Forward
0 new messages