Hi, I have doubts about what you are trying to do will even compile. I suggest you take a look at the puppet docs on templating to get a clearer picture: http://docs.puppetlabs.com/guides/templating.html
and after that you should take a look at variables: http://docs.puppetlabs.com/learning/variables.html That should make some things a little clearer for you. Cheers, Den On Tue, Dec 6, 2011 at 2:18 PM, Vitthal Gogate <vitthal.gog...@gmail.com> wrote: > bit more explaination on what I am trying and appreciate if some one > can throw some light on how to get it working? > > I define bunch of global variables in puppet Site.pp and try generate > the hadoop configuration file based on that using puppet template. We > expect "value" in the config.erb template to be substituted by the > actual value of global_jobtracker_host. This is two phase > substitution, first value is substituted as "<%= > global_jobtracker_host %>:50030" then "global_jobtracker_host" part > should be replaced by actual value "myhost.xxx.com". Is it possible? > > Site.pp > =============== > global_jobtracker_host = myhost.xxx.com > global_namenode_host = myhost.xxx.com > conf_map = { 'mapred.job.tracker' => '<%= > global_jobtracker_host %>:9000', > 'mapred.job.tracker.http.address' => '<%= > global_jobtracker_host %>:50030' > } > > file {"$hadoop_conf_dir/mapred-site.xml": > ensure => present, > content => template ("/tmp/config.erb") > } > ================ > > /tmp/config.erb > ================ > <configuration> > <% conf_map.each do |key,value| -%> > <property> > <name><%= key %></name> > <value><% value %></value> > </property> > <% end -%> > </configuration> > ================== > > On Dec 5, 12:14 pm, Vitthal Gogate <vitthal.gog...@gmail.com> wrote: >> I have following erb template in my puppet module. The "value" itself >> is template expression e.g. <%= some_puppet_global_variable %>. I >> expect this value to be substituted and evaluated to finally have the >> value of "some_puppet_global_variable" substituted in the content. >> >> Pl. let me know how to achieve it? >> >> puppet template file: >> >> <configuration> >> <% conf_category_map.each do |key,value| -%> >> <config> >> <name><%= key %></name> >> <value><% value %></value> >> </config> >> <% end -%> >> </configuration> > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.