使用自定义ohai插件在运行列表中排列食谱



我有一本包含自定义ohai插件的wapper食谱。这个插件在我的第二本食谱中使用过。我的config.rb文件正确吗?

cookbook_path [
'/home/user/.chef/cookbooks',   #<< ohai cookbook
'/home/user/cookbooks'          #<< wrapper cookbook (ohai plugin) and second cookbook
]
ohai.plugin_path += [
'/home/user/cookbooks/ohai/plugins'
]
ohai.directory '/home/user/cookbooks/ohai/plugins'

有必要在第二本食谱之前将带有ohai插件的包装食谱放在运行列表中吗?

更新:

当我更新我的自定义ohai插件属性并运行chef客户端时,更新后的ohai插件会复制到指定的位置/etc/chef/ohai/plugins,但日志信息仍然显示以前的值。

include_recipe 'ohai'
ohai 'reload' do
plugin 'example'
action :nothing
end
cookbook_file "#{node['ohai']['plugin_path']}/example.rb" do
source 'example.rb'
notifies :reload, 'ohai[reload]', :immediately
end
test = "#{node['ohai']['example']}"
log test 

使用ohai资源加载自定义插件。

最新更新