Thanks a lot for both answers! Very helpful. However, I was a little surprised that how slow Puppet was when I run your example. Was it Puppet just slow or was it just my VM is slow? I literally had to wait 1 min to get the result:
Thu Jun 30 10:37:56 PDT 2011 notice: Finished catalog run in 0.02 seconds Thu Jun 30 10:38:58 PDT 2011 Did I do anything wrong here? I was running it under Ubuntu 10.04 Thanks again! On Wed, Jun 29, 2011 at 7:11 PM, vagn scott <vagnsc...@gmail.com> wrote: > On 06/29/2011 09:56 PM, treydock wrote: >> >> <% apparray.each do |key,value| -%> >> >> Key:<%= key %> >> Path:<%= value['path'] %> >> Command:<%= value['command'] %> >> >> <% end -%> > > inline_template() can be used as a here document. > that plus a puppet shebang line makes testing > and presenting examples really easy. > > Put the following in file here-hash.pp, then > > chmod +x here-hash.pp > ./here-hash.pp > > --vagn > > ---------------8<---------------------------------------------------------------------------- > > #! /usr/bin/puppet apply > > Exec { > path => > "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" > } > > $prog_name = "here-hash.pp" > > $apparray = { > app1 => { 'path' => '/test/path1', 'command' => 'cmd1' }, > app2 => { 'path' => '/test/path2', 'command' => 'cmd2' }, > } > > $result = inline_template(" > > <% apparray.each do |key,value| -%> > > Key: <%= key %> > Path: <%= value['path'] %> > Command: <%= value['command'] %> > > <% end -%> > > ") > > > node default { > > notice("--- running: $program_name > -------------------------------------") > > notice($result) > > notice("--- done: $program_name > ----------------------------------------") > } > > -- > 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.