Filtering with Values within Dictionary of the List (FortiOS Facts)

5 views
Skip to first unread message

Ume

unread,
Feb 9, 2023, 2:27:08 PM2/9/23
to Ansible Development
Hello All,

I am tyring to use filter with Values within Dictionary of the List (FortiOS Facts). Sample Resp onse from FortiGate (Facts)

      "results": [
        {
          "policyid": 1,
          "q_origin_key": 1,
          "status": "enable",
          "name": "test-policy01",
          "uuid": "c4de3298-97ce-51ed-ccba-cafc556ba9e0",
          "uuid-idx": 14729,
          "srcintf": [
            {
              "name": "port2",
              "q_origin_key": "port2"
            }
          ],

Ansible Filter works fine for the following code

      - name: To Fetch Existing Firewall Polices Based on Selector firewall_policy  
        fortios_configuration_fact:
          vdom:  "{{ vdom }}"
          access_token: "{{ fortigate_access_token }}"
          selector: "firewall_policy"
          filters:
            - action=="accept"
        register: existing_fw_policy_object
        when: existing_fw_name is defined    

      - name: Display Existing Firewall Policy
        debug:
          msg: "{{ existing_fw_policy_object }}"


What is the way to filter on srcintf. Wanted to Filter Firewall Policy with port2.
Reply all
Reply to author
Forward
0 new messages