Ansible run a task on a different host than local
Solution 1:
Q: "Is it possible to achieve this scenario without invoking two ansible playbooks?"
A: Yes. It's possible. Split the playbook into plays, e.g.
- hosts: localhost
tasks:
- include_role:
name: role1
tasks_from: task1
- include_role:
name: role1
tasks_from: task2
- hosts: controllergroup
tasks:
- include_role:
name: role2
tasks_from: task4
- hosts: localhost
tasks:
- include_role:
name: role2
tasks_from: task4
- include_role:
name: role2
tasks_from: task5