# Using delegate\_to in combination with roles in a playbook

**URL:** <https://forum.ansible.com/t/using-delegate-to-in-combination-with-roles-in-a-playbook/15470>\
**Category:** Ansible Project\
**Created:** [June 16, 2014, 8:54am UTC](https://forum.ansible.com/t/using-delegate-to-in-combination-with-roles-in-a-playbook/15470 "2014-06-16T08:54:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Harvey](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@Paul\_Harvey](https://forum.ansible.com/u/Paul_Harvey)\
**Post date:** [June 16, 2014, 8:54am UTC](https://forum.ansible.com/t/using-delegate-to-in-combination-with-roles-in-a-playbook/15470/1 "2014-06-16T08:54:52Z")

</div>

Hi,

Is it possible to delegate the execution of an _entire play_ to a another host?

I have a playbook that contains a set of reusable roles, the tasks in these roles will not generally be delegated. However in this case I need to run the entire playbook delegated to a different host.

So either I need mechanism to “globally” delegate the execution of my playbook, or else a way to mark each of the roles when included in my playbook to have all of their tasks similarly delegated.

Is this functionality supported by Ansible?

Thanks,

Paul.

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [June 16, 2014, 3:31pm UTC](https://forum.ansible.com/t/using-delegate-to-in-combination-with-roles-in-a-playbook/15470/2 "2014-06-16T15:31:49Z")

</div>

Why not simply specify the ‘hosts:’ in that play as the ones you are wishing to delegate the tasks? If you need that to be more dynamic, you can use the group\_by module to create the targeted group, and you can also use a variable for the ‘hosts:’.
