It's not possible. Quoting from ansible.builtin.import_playbook
Files with a list of plays can only be included at the top level.
The example explicitly shows this
- name: This DOES NOT WORK hosts: all tasks: - debug: msg: task1 - name: This fails because I'm inside a play already import_playbook: stuff.yaml Notes
- There is no include_playbook. See what include_* and import_* modules are available.
shell> ansible-doc -t module -l | grep include_ include_role Load and ... include_tasks Dynamically inclu... include_vars Load variables from files, dynamically... shell> ansible-doc -t module -l | grep import_ import_playbook Imp... import_role Import a ro... import_tasks Impo... - Quoting note from import_module:
This is a core feature of Ansible, rather than a module, and cannot be overridden like a module.