我有3个食谱
在my_app中我
default.rb
default[:my_app][:user] = "#{node[:my_db_client][:user]}"
default[:my_app][:group] = "#{node[:my_db_client][:group]}"
default[:my_app][:user_home] = "#{node[:my_db_client][:user_home]}"
default[:my_app][:base] = "#{node[:my_db_client][:base]}"
default[:my_app][:oracle_client_home] = "#{node[:my_db_client][:oracle_home]}"
在my_db_client中我
default.rb
default[:my_db_client][:user] = "" --(Set from Role)
default[:my_db_client][:group] = "" --(Set from Role)
default[:my_db_client][:user_home] = "" --(Set from Role)
default[:my_db_client][:base] = "" --(Set from Role)
default[:my_db_client][:oracle_client_home] = "#{node[:my_db_client][:base]}/oracle/home"
基于role1
default_attributes(
:my_db_client => {
:user => "myuser",
:group => "mygroup",
:user_home => '/home',
:base => '/u01'
}
)
run_list(
"recipe[my_db_client]",
"recipe[my_app::_install]"
)
role2所
default_attributes(
:my_java => {
:user => "myuser",
:group => "mygroup",
:user_home => '/home',
:base => '/u01'
}
)
run_list(
"recipe[my_java]",
"recipe[my_db_client]",
"recipe[my_app::_install]"
)
对于Role1,事情很好。
但是对于Role2,默认的my_db_client值设置为“”
[:my_db_client][:user] = ""
我怎样才能设置以下值?
default[:my_db_client][:oracle_client_home] = "#{node[:my_db_client][:base]}/oracle/home"
答案 0 :(得分:0)
如果您希望默认值node['my_db_client']['user']
为node['my_java']['user']
的值,请在属性文件中执行此操作。不确定问题是什么,因为你已经在其他情况下已经这样做了所以你必须因某些特定原因而将其遗漏?