# How to deploy ohai plugin

**URL:** <https://discourse.chef.io/t/how-to-deploy-ohai-plugin/20633>\
**Category:** Chef Infra (archive)\
**Created:** [January 4, 2022, 9:32am UTC](https://discourse.chef.io/t/how-to-deploy-ohai-plugin/20633 "2022-01-04T09:32:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bartv](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bartv/32/3458_2.png) [@bartv](https://discourse.chef.io/u/bartv)\
**Post date:** [January 4, 2022, 9:32am UTC](https://discourse.chef.io/t/how-to-deploy-ohai-plugin/20633/1 "2022-01-04T09:32:57Z")

</div>

Hello,

I'm a little confused by how custom ohai plugins should be "deployed" on the target servers on which they are required. The [docs](https://docs.chef.io/ohai_custom/) say in order to install the plugin, you create an ohai directory in the cookbook, and move the plugin in there.

When I create a cookbook with this `ohai` directory (and no recipes) and add this cookbook to my policy, I receive an error

```auto
Error: Failed to generate Policyfile.lock
Reason: (ChefCLI::CookbookDoesNotContainRequiredRecipe) The installed cookbooks do not contain all the recipes required by your run list(s):
Cookbook ... is missing the following required recipes:
* default

```

When I add an empty recipes/default.rb file, the policy gets created, and when it executed, the cookbook is synchronized with ohai/plugin.rb file in the cache, the runlist shows the plugin default recipe and the plugin ran.

So, is this the correct way to deploy an ohai plugin to all servers using a policy, using an empty default recipe?

---

<div class="post-metadata">

**Author:** ![horns](https://avatars.discourse-cdn.com/v4/letter/h/ecb155/32.png) [@horns](https://discourse.chef.io/u/horns)\
**Post date:** [January 10, 2022, 7:29pm UTC](https://discourse.chef.io/t/how-to-deploy-ohai-plugin/20633/2 "2022-01-10T19:29:55Z")

</div>

Yes, that's it. Generally, it is expected that if you are using Policyfiles, you will have a cookbook recipe of some kind.

If you just want to deploy ohai plugins, your example would be a way to do it while using Policyfiles.
