- From: Bryan Berry <
>
- To:
- Subject: [chef] how to manage dependent resources?
- Date: Wed, 29 Feb 2012 09:53:22 +0100
- Authentication-results: mr.google.com; spf=pass (google.com: domain of
designates 10.52.34.109 as permitted sender)
; dkim=pass
I have an issue where I need to provide values generated dynamically by one resource to resources that follow it
My tomcat lwrp generates a base directory for each new instance that is a readable attribute "base"
Following resources will use that base attribute. In this example, the ivy resource should place a .jar file in the #{base}/lib directory
include_recipe "ark"
include_recipe "tomcat::base"
include_recipe "ivy"
t = tomcat "jira" do
user node['jira']['user']
action :install
end
# get mysql connector
ivy "mysql-connector-java" do
groupId "mysql"
version "5.1.18"
dest "#{t.base}/lib" # evaluates to "/lib"
end
ruby_block "foobarbaz" do
block do
Chef::Log.debug("t.base is #{t.base}") # t.base evaluates to "/usr/local/tomcat/jira"
end
end
I have found a solution thanks to Jorge Espada, but there really should be a more straightforward way to do this.
t = tomcat "jira" do
user node['jira']['user']
action :nothing
end
t.run_action :install
- [chef] how to manage dependent resources?, Bryan Berry, 02/29/2012
Archive powered by MHonArc 2.6.16.