On Wed, 3 Aug 2022 14:29:27 -0700 (PDT)
"[email protected]" <[email protected]> wrote:

>  - 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 }}"

Try this:

  - debug:
      msg: "{{ _item }} is in app profile: {{ app_profile }}"
    loop: "{{ epg_bd_list }}"
    vars:
      _item: "{{ item.fvAEPg.attributes.name }}"
      _query: '[?epg_name.contains(@, `{{ _item }}`)].app_name'
      app_profile: "{{ application_profiles|json_query(_query) }}"


Note: In the JSON, the braces {} are not properly balanced. Use YAML

      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

      epg_bd_list:
        - fvAEPg:
            attributes:
              name: SPAN-destination-analysis
              nameAlias: vl2022
        - fvAEPg:
            attributes:
              name: vl72
              nameAlias: Bone_Centre

-- 
Vladimir Botka

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20220804065141.5d1a20eb%40gmail.com.

Attachment: pgpaW18ZrzlhU.pgp
Description: OpenPGP digital signature

Reply via email to