我正在尝试将 chef 与 aws opsworks 一起使用。
但是它似乎没有加载我的模板。
这是有关配方的一部分,位于 /api/recipes/configure.rb
# write out our applications site configurations
template "/etc/httpd/sites-available/#{application}.conf" do
source 'site-config.erb'
owner 'root'
group 'root'
mode 0644
variables(
:docroot => "#{deploy[:deploy_to]}/public"
)
end
这是堆栈跟踪
[2014-04-15T05:08:03+00:00] INFO: Processing template[/etc/httpd/sites-available/testing_app.conf] action create (api::configure line 33)
================================================================================
Error executing action `create` on resource 'template[/etc/httpd/sites-available/testing_app.conf]'
================================================================================
Chef::Exceptions::FileNotFound
------------------------------
Cookbook 'api' (0.1.0) does not contain a file at any of these locations:
templates/amazon-2013.09/site-config.erb
templates/amazon/site-config.erb
templates/default/site-config.erb
Resource Declaration:
---------------------
# In /var/lib/aws/opsworks/cache/cookbooks/api/recipes/configure.rb
33: template "/etc/httpd/sites-available/#{application}.conf" do
34: source 'site-config.erb'
35: owner 'root'
36: group 'root'
37: mode 0644
38: variables(
39: :docroot => "#{deploy[:deploy_to]}/public"
40: )
41: end
42:
Compiled Resource:
------------------
# Declared in /var/lib/aws/opsworks/cache/cookbooks/api/recipes/configure.rb:33:in `block in from_file'
template("/etc/httpd/sites-available/testing_app.conf") do
provider Chef::Provider::Template
action "create"
retries 0
retry_delay 2
path "/etc/httpd/sites-available/testing_app.conf"
backup 5
atomic_update true
source "site-config.erb"
variables {:docroot=>"/srv/www/testing_app/public"}
cookbook_name "api"
recipe_name "configure"
owner "root"
group "root"
mode 420
end
[2014-04-15T05:08:03+00:00] INFO: Running queued delayed notifications before re-raising exception
[2014-04-15T05:08:03+00:00] ERROR: Running exception handlers
[2014-04-15T05:08:03+00:00] ERROR: Exception handlers complete
[2014-04-15T05:08:03+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache/chef-stacktrace.out
[2014-04-15T05:08:03+00:00] ERROR: template[/etc/httpd/sites-available/testing_app.conf] (api::configure line 33) had an error: Chef::Exceptions::FileNotFound: Cookbook 'api' (0.1.0) does not contain a file at any of these locations:
templates/amazon-2013.09/site-config.erb
templates/amazon/site-config.erb
templates/default/site-config.erb
[2014-04-15T05:08:04+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
这是我的目录结构