with_dict and with_items together in ansible task

Hi

My requirement is to install multiple patches on different machines based on which all tiers the patch is supported for install. Say patch1 should be installed on client group and service group, patch2 should be installed on client group and database group machines.

  • name: Install patch on services tier
    include: roles/common/tasks/install_patch_services.yml
    when: ({{item.value.services_repo}} == True)
    with_dict: “{{patches_dict}}”
    delegate_to: “{{ groups.is_services[0] }}”

Here I am using dict to traverse through all patches and install on different groups.
If there are multiple hosts in a group, how can I write a task? It should consider patch1 install on services[0], services[1] and patch2 on services[0],services[1] and so on…

Please provide your inputs how it can be achieved ?