# Chef loop to run on all my nodes

**URL:** <https://discourse.chef.io/t/chef-loop-to-run-on-all-my-nodes/16694>\
**Category:** Chef Infra (archive)\
**Created:** [February 14, 2020, 4:49pm UTC](https://discourse.chef.io/t/chef-loop-to-run-on-all-my-nodes/16694 "2020-02-14T16:49:29Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![ccrebolder](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/ccrebolder/32/144_2.png) [@ccrebolder](https://discourse.chef.io/u/ccrebolder)\
**Post date:** [February 14, 2020, 9:09pm UTC](https://discourse.chef.io/t/chef-loop-to-run-on-all-my-nodes/16694/5 "2020-02-14T21:09:34Z")

</div>

To solve your immediate problem, you can run `knife ssh QUERY COMMAND --concurrency NUM` where it will only run the command on `NUM` nodes at once, but chef is designed to be idempotent, so running once an hour should definitely not be a problem if the recipe is designed properly. You might need a `not_if` or `only_if` guard on your patching resource.

---

_[View the full topic](https://discourse.chef.io/t/chef-loop-to-run-on-all-my-nodes/16694)._
