How to compely exclude an host in a playbook after filtering for installed SW

got it:
how to test for the 3 Wazuh apps installed and end_host the host without wazuh - now i have to fuse it with the update playbook:

- name: Check Wazuh Packages
  hosts: all
  become: yes
  vars:
    wazuh_packages:
      - wazuh-indexer
      - wazuh-manager
      - wazuh-dashboard

  tasks:
    - name: Gather facts about installed packages
      package_facts:
        manager: auto

    - name: Check if any Wazuh package is missing
      set_fact:
        wazuh_missing: "{{ wazuh_packages | difference(ansible_facts.packages.keys()) }}"

    - name: End play if any Wazuh package is missing
      meta: end_host
      when: wazuh_missing | length > 0

    - name: Output success message for hosts with all Wazuh packages installed
      ansible.builtin.debug:
        msg: "All Wazuh packages are installed on {{ inventory_hostname }}."