# Execute task only once in playbook (not per host)

**URL:** <https://forum.ansible.com/t/execute-task-only-once-in-playbook-not-per-host/24667>\
**Category:** Ansible Project\
**Created:** [June 7, 2017, 8:20am UTC](https://forum.ansible.com/t/execute-task-only-once-in-playbook-not-per-host/24667 "2017-06-07T08:20:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![user63](https://avatars.discourse-cdn.com/v4/letter/u/49beb7/32.png) [@user63](https://forum.ansible.com/u/user63)\
**Post date:** [June 7, 2017, 8:20am UTC](https://forum.ansible.com/t/execute-task-only-once-in-playbook-not-per-host/24667/1 "2017-06-07T08:20:35Z")

</div>

Hi,

Currently implementing following scenario in ansible:

Auto generation of configurations of Bacula backup system, in single playbook I generate both client and server configs (server configs generated by delegete\_to option to be on correct server)

For small amount of hosts everything worked fine, but when adding many hosts to single playbook execution I face problem that bacula server is restarted too fast and fails at some moment with error:

**failed because start of the service was attempted too often.**

But actually I need to restart bacula server just once for all hosts. (single run per playbook, not per host)

I did not find any solution for this, any recommendations/scenarios how we can achieve this?

Of course as alternative I can run restart bacula server as separate playbook run but I think all in one approach is more correct.

---

<div class="post-metadata">

**Author:** ![Karol\_Czeryna](https://avatars.discourse-cdn.com/v4/letter/k/ed655f/32.png) [@Karol\_Czeryna](https://forum.ansible.com/u/Karol_Czeryna)\
**Post date:** [June 7, 2017, 2:07pm UTC](https://forum.ansible.com/t/execute-task-only-once-in-playbook-not-per-host/24667/2 "2017-06-07T14:07:35Z")

</div>

Hi!

I think you are looking for this:

[http://docs.ansible.com/ansible/playbooks\_delegation.html#run-once](http://docs.ansible.com/ansible/playbooks_delegation.html#run-once)

Best,  
Karol
