Skip import playbook using when condition.

If there are no hosts added to add host, subsequent plays should be skipped. Please let me know how to provide when condition for this

- name:
  hosts: rchadm01
  vars_files:
  - var.yml
  tasks:
    - name:
      add_host:
        name: "{{ decom_host }}"
        groups: decom_host_group

- import_playbook: sub_plays/play2.yml
  when: '"decom_host_group" not in group_names'

If there are no hosts added to add host, subsequent plays should be
skipped. Please let me know how to provide when condition for this

with import_*, the import happens unconditionally and the specified conditions on the import are applied to each task imported.

V/r,
James Cassell

Ok, Thank you James