Z/os ansible find multiple string

Your last post - prior to editing - showed the structure of display_output, from which I could construct the following tasks. They should show you how to determine the number of “is active on” lines in display_output’s SYSTSPRT DD.

    - name: Select SYSTSPRT 'is active on' lines
      ansible.builtin.set_fact:
        is_active_on: "{{ display_output.jobs[0].ddnames
                          | selectattr('ddname','eq','SYSTSPRT')
                          | map(attribute='content')
                          | map('select', 'match', '.* is active on ')
                          | flatten
                       }}"

    - name: Show the 'is active on' lines, and count them
      ansible.builtin.debug:
        msg:
          - "{{ is_active_on }}"
          - "{{ is_active_on | length }}"

(I haven’t seen “IEF” messages since December of 1996. [shivers])

2 Likes