Hi I have been trying to access all the sub-elements available in a map but 
i am unable to do so:

Here's my usecase:

A yaml map is defined as follows:

object:
    element1: "value1"
    element2: "value2"
    element3: "value3"
    ...
    ...
    ...
    elementn: "valuen"

In a task i need to access all the values (value1,value2,value3,...,valuen)

I tried the following:

- name: pass values to script
      debug: "msg={{ item }}"
      with_items:
        - "{{ object }}"

But this doesn't seem to work.

Whereas the following works,

- name: pass values to script
      debug: "msg={{ item }}"
      with_items:
        - "{{ object.element1 }}"
        - "{{ object.element2 }}"

But this is not scalable, and i have a usecase where the number of elements 
might vary. Is there a way to get this done in ansible ?


Regards,
Naween

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/da9e4739-eefa-4975-adc3-65ad0b6a3610%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to