Hi,

I have the following data:
    "application_profiles": [
        {
            "app_desc": "",
            "app_name": "NCS_Net_inf",
            "epg_name": [
                "SPAN-destination-analysis",
                "infra_auth_servers",
                "netinf_test_servers",
                "paaa-infra-mgt",
                "vl2003"
            ]
        },
        {
            "app_desc": "dept: MedIT",
            "app_name": "faculty_of_medicine",
            "epg_name": [
                "medit_jump_server"
            ]
        },
        {
            "app_desc": "",
            "app_name": "dc_qa_app_fe",
            "epg_name": [
                "vl3800"
            ]
        }
    ]
}

AND

   "epg_bd_list": [
        {
            "fvAEPg": {
                "attributes": {
                    "name": "SPAN-destination-analysis",
                    "nameAlias": "vl2022"
                },
        {
            "fvAEPg": {
                "attributes": {
                   "name": "vl72",
                    "nameAlias": "Bone_Centre"

                 }
]

I'm trying to do a json_query using the contain function but I cannot seem 
to figure out how to use it properly.
 - debug:
      msg: "{{ item.fvAEPg.attributes.name }} is in app profile: {{ 
application_profiles | to_json | from_json | 
json_query('*.[?epg_name.contains(@, `{{ item.fvAEPg.attributes.name 
}}`)].app_name') }}"
    loop: "{{ epg_bd_list }}"


I've done a lot of json_query but this is the first time that the variable 
I am searching for "epg_name" is a list and not a single item.  I managed 
to make it work if the matching "item.fvAEPg.attributes.name" is the first 
item in the list.  I'd like to pick out the app_name if the 
item.fvAEPg.attributes.name is in the list of epg_name.

Thanks,
Spiro

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/039c2014-57ef-4649-a578-ea7aa9134840n%40googlegroups.com.

Reply via email to