0

I have chef configured to add "/etc/chef/ohai_plugins" to Ohai::Config[:plugin_path]. However, the Chef documentation says:

"The Ohai executable ignores settings in the client.rb file when Ohai is run independently of the chef-client."

So, how can I get a stand-alone run of ohai to load and use the plugins in that custom path?

(Background: I have a custom plugin that reports some information that we keep track of for a fleet of servers, like whether a server has been patched for heartbleed or shellshock. I want to be able to run "ssh somehost ohai", parse the JSON that gets sent back, and extract the information I need.)

Thanks.

Creede
  • 153
  • 1
  • 11

2 Answers2

1

Outside of chef, you can add an additional plugin path using the -d switch, e.g.

$ ohai -d /etc/chef/ohai_plugins

The relevant source code is at:

The option to specify a custom config file for Ohai was sadly removed last year with https://github.com/chef/ohai/commit/ebabd088673cf3e36d600bd96aeba004077842f1

Hope this answers your question.

Roland
  • 1,426
  • 9
  • 9
  • I think that's probably as good as I'm going to get. Thanks for the pointer to the code and the change. – Creede Jun 26 '15 at 05:04
1

This will be possible soon via the implementation of Chef RFC 53: https://github.com/chef/chef-rfc/blob/master/rfc053-ohai-config.md

coderanger
  • 52,400
  • 4
  • 52
  • 75