# Run cookbooks on multiple nodes but limited groups at a time

**URL:** <https://discourse.chef.io/t/run-cookbooks-on-multiple-nodes-but-limited-groups-at-a-time/14907>\
**Category:** Chef Infra (archive)\
**Created:** [April 9, 2019, 2:31pm UTC](https://discourse.chef.io/t/run-cookbooks-on-multiple-nodes-but-limited-groups-at-a-time/14907 "2019-04-09T14:31:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Odysseaus](https://avatars.discourse-cdn.com/v4/letter/o/ccd318/32.png) [@Odysseaus](https://discourse.chef.io/u/Odysseaus)\
**Post date:** [April 9, 2019, 2:31pm UTC](https://discourse.chef.io/t/run-cookbooks-on-multiple-nodes-but-limited-groups-at-a-time/14907/1 "2019-04-09T14:31:18Z")

</div>

I know how to run chef cookbooks on multiple nodes at once. What I need to do now is run cookbooks on multiple nodes but in blocks at a time. Running a mass rhel yum update on all chef nodes at once causes errors with the my internal rhel database. Is there a way to limit the number of nodes getting an update and when a group of nodes is complete, move on to the next group of nodes and so on?

---

<div class="post-metadata">

**Author:** ![Odysseaus](https://avatars.discourse-cdn.com/v4/letter/o/ccd318/32.png) [@Odysseaus](https://discourse.chef.io/u/Odysseaus)\
**Post date:** [April 9, 2019, 2:54pm UTC](https://discourse.chef.io/t/run-cookbooks-on-multiple-nodes-but-limited-groups-at-a-time/14907/2 "2019-04-09T14:54:58Z")

</div>

Better yet I just need to run cookbooks on all my nodes but just run them 5 at a time. I don't want to run a single cookbook on all nodes at the same time because it causes major issues.

---

<div class="post-metadata">

**Author:** ![campbell](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/campbell/32/2316_2.png) [@campbell](https://discourse.chef.io/u/campbell)\
**Post date:** [April 10, 2019, 12:06am UTC](https://discourse.chef.io/t/run-cookbooks-on-multiple-nodes-but-limited-groups-at-a-time/14907/3 "2019-04-10T00:06:52Z")

</div>

Hey @Odysseaus!

Thank you for your question - I totally understand why you want to do this, however in practice this ends up causing some pretty gnarly headaches within your environment.

My advice would be to use the [chef-client cookbook](https://github.com/chef-cookbooks/chef-client) to manage your client configurations on your nodes, then investigate setting the `node['chef-client']['splay']` attribute ([GitHub - chef-boneyard/chef-client: Development repository for Chef Client cookbook](https://github.com/chef-cookbooks/chef-client#attributes)).

Splay is [described as](https://docs.chef.io/ctl_chef_client.html):

> A random number between zero and splay that is added to interval. Use splay to help balance the load on the Chef server by ensuring that many chef-client runs are not occurring at the same interval. When the chef-client is run at intervals, --splay and --interval values are applied before the chef-client run.

For example, let's say you have a client run interval of 60 minutes. You should be able to safely set a `splay` of 30-45 minutes to balance the chef-client converges in your environment.

This would hopefully smooth the load on your upstream artifact repositories that are struggling during converge.
