The Ohai docs are incomplete. Here's what I've been able to do so far:
- I've created a custom plugin that adds one piece of node data called "my_custom_data"
- it works when I load it manually in IRB
- I've used the Ohai cookbook to get it loaded on the servers that need it
However, Ohai doesn't load it, neither during Chef runs nor if I run Ohai manually.
The docs, here, are of little use in answering this question. http://docs.opscode.com/ohai.html
Your question implies that you're already using the Ohai cookbook to distribute the plugin, and that that much is working - ie, your custom plugin ends up installed to
/etc/chef/ohai_plugins
(in the default configuration). If that's the case, it's almost certainly trying to load the plugin - and the plugin is failing.Ohai doesn't worry about failing plugins - it simply moves on to the next one.
When running by hand, make sure you're telling ohai to look in the additional plugin directory. Here's how that fails (for a custom plugin called 'aws'):
Finally, if you're seeing no output (but no errors), enable debug logging and search through the output to find the part associated with your plugin:
You need to make sure that you have the following line in /etc/chef/client.rb. If you are using knife bootstrap, you will need to specify a template.