Hi,

I'd like to load variables from a file into a dictionary, so I can later
iterate over that dictionary.

I've managed to load vars into their own dictionaries based on their name:

- name: load services definitions for the product
  include_vars:
    file: "../model/service/{{ item }}.yaml"
    name: "service_data_{{ item }}"
  with_items: "{{ product_data.services }}"

I've tried various syntax with the 'name' parameter, but I always end up
with it being treated as a string.

This ends up looking like this:
        "service_data_access_interface": {
            "resources": [
                "interface"
            ],
            "service_name": "access_interface",
            "service_vars": [
                {
                    "mandatory": true,
                    "name": "description",
                    "type": "string"
                }
            ]
        },
        "service_data_l2vpn": {
            "resources": [
                "routing_instance"
            ],
            "service_name": "l2vpn",
            "service_vars": [
                {
                    "mandatory": true,
                    "name": "description",
                    "type": "string"
                }
            ]
        },

Which makes it very difficult to iterate over. Id like to iterate of this
to get to the inner level of 'service_vars', names like 'l2vpn' or
'access_interface' come from another dictionary (that's loaded earlier)

Any idea how to either import into into a dictionary (so i could use
subelements) or iterate over the 'service_vars' (knowing part of the string
used to create the key)?

kind regards
Pshem

-- 
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/CAEaZiRVtd-m92tGv%3DS%3DYyXP76VEwovRgu8txiob2_JEh369Mow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to