linux - Why Chef do not find my files? -
i'm developing ganglia
recipe in chef
. simple, build 4 different configurations files, tried use template
, keep simple, build these configuration files.
this recipe:
return if tagged?('norun::ganglia') case node[:platform] when "ubuntu", "debian" pkg = "ganglia-monitor" when "redhat", "centos", "fedora" pkg = "ganglia-gmond" end package "#{pkg}" action :install end cookbook_file "/etc/ganglia/gmond.conf" owner "root" group "root" mode "0644" source "gmond/" + node['base']['dc'] + "/node/gmond.conf" end # adding ganglia-gmond service service "gmond" supports :status => true, :restart => true action [ :enable, :start ] end
and how recipe structured:
cookbooks/ganglia/ cookbooks/ganglia/files/default/gmond/* // have others sub-folders here cookbooks/ganglia/files/default/gmond/diveo/node/gmond.conf cookbooks/ganglia/recipes/default.rb
but when tried run recipe, gives follow error:
[2013-05-14t14:23:38+00:00] fatal: chef::exceptions::filenotfound: cookbook_file[/etc/ganglia/gmond.conf] (ganglia::default line 25) had error: chef::exceptions::filenotfound: cookbook 'ganglia' (0.1.0) not contain file @ of these locations: files/centos-5.7/gmond/diveo/node/gmond.conf files/centos/gmond/diveo/node/gmond.conf files/default/gmond/diveo/node/gmond.conf cookbook _does_ contain: ['diveo/monitor/gmond.conf','diveo/node/gmond.conf','awsvir/monitor/gmond.conf','awsvir/node/gmond.conf','awssp/monitor/gmond.conf','awssp/node/gmond.conf','alog/monitor/gmond.conf','alog/node/gmond.conf']
basically says not have file, do, in right path, right ?
if node['base']['dc']
platform name, cookbook_file
statement should like
cookbook_file "/etc/ganglia/gmond.conf" owner "root" group "root" mode "0644" source "gmond.conf" end
and structure of conf files should that
cookbooks/ganglia/ cookbooks/ganglia/files/default/gmond.conf cookbooks/ganglia/files/centos-5.7/gmond.conf ...
and little advice - use template
instead of cookbook_file
. 1 day you'll want add parameters gmane.conf
anyway.
also, here cookbook_file
doc page opscode.com -
Comments
Post a Comment