How to specify a directory for custom ohai plugins?

291 Views Asked by At

The ohai-example helps a lot to package a ohai plugin in a cookbook. In my default recipe I use

 ohai_plugin 'ohai-example'

After a chef.run the custom ohai plugin is placed at

 /home/user/cookbooks/ohai/plugins/ohai-example.rb

I use the following parameters for the chef run:

chef-client --local-mode -c config.rb

My config.rb

chef_zero.enabled true
cookbook_path [
    '/home/user/.chef/cookbooks',    #ohai cookbook
    '/home/user/cookbooks'           #ohai-example cookbook 
]
local_mode true

Is it possible to specify another directory for the ohai plugins?

1

There are 1 best solutions below

1
On

use ohai_plugin resource and utilize the path attribute

path - The path to your custom plugin directory. Defaults to a directory named 'plugins' under the directory 'ohai' in the Chef config dir.