- From: <
>
- To:
- Subject: [chef] Using "subscribes" in recipes
- Date: Sun, 5 May 2013 05:03:20 -0700 (PDT)
Hi, I'm trying to make a modification to a package that is installed by
several
different recipes.
Since I'm trying not to modify the the cookbook directly, I believe the best
way to do this is to create a recipe with some actions that include a
"subscribes" line. After reading the documentation, some googling, and a
number
of attempts, I'm still a bit unclear on how to do this.
Any tips on how to do this correctly would be appreciated. Here's what I've
tried so far:
--------------
# In main cookbook
package "tomcat" do
action :install
end
--------------
# In my (simplified) recipe
directory "/bigdrive/tomcat/tmp" do
owner node['tomcat']['user']
group node['tomcat']['group']
mode 0755
action :create
subscribes :install, resources("packages[tomcat]"), :immediately
end
# Update configuration
ruby_block "update_tomcat_defaults" do
block do
file =
Chef::Util::FileEdit.new("/etc/default/tomcat#{node["tomcat"]["base_version"]}")
props = [ "export JVM_TMP=\"/bigdrive/tomcat/tmp\"" ]
file.insert_line_after_match(/LANG\=/, props.join("\n"))
file.write_file
end
subscribes :install, resources("packages[tomcat]"), :immediately
end
- [chef] Using "subscribes" in recipes, chef-list, 05/05/2013
Archive powered by MHonArc 2.6.16.