- From: Sachin Gupta <
>
- To: "
" <
>
- Cc: sachin kumar <
>
- Subject: [chef] how to append an variable using chef
- Date: Mon, 8 Jun 2015 16:08:22 +0530
Hi All,
I need to set an attribute variable through chef recipe.
I an using a role file where I have defined weblogic cluster information like
"wls_cluster": {
"oci_cluster1": {
"managed_servers": {
"oci_man1": {
"ip_address": "10.10.10.31",
"listen_port": "7101"
},
"oci_man2": {
"ip_address": "10.10.10.32",
"listen_port": "7101"
}
}
},
my weblogic oci_cluster1 can have any number of managed servers, is this example there are two
In my chef recipe i am using this code to fetch run time managed servers information
node[:ohs][:wls_cluster].each do |cluster, cluster_attrib|
cluster_attrib.managed_servers.each do |managed_server, man_attrib|
Chef::Log.info "the IP address is #{man_attrib.ip_address} and port is #{man_attrib.listen_port}"
node.set[:ohs][:wls_cluster] = "#{man_host}:#{man_port},"
Chef::Log.info "the value of wls_cluster are #{node[:ohs][:wls_cluster]}"
end
end
I have an attribute variable default[:ohs][:wls_cluster] ='' initially set to null, I want to set this variable through chef recipe something like
[:ohs][:wls_cluster]= "ip_address:listen_port,ip_address:listen_port,ip_address:listen_port...."
can anyone help how to append the variable values using chef.
Thanks & Regards,
Sachin Gupta
- [chef] how to append an variable using chef, Sachin Gupta, 06/08/2015
Archive powered by MHonArc 2.6.16.