Thanks, that worked perfectly! I had no idea key and value were reserved words.
On Mon, May 16, 2011 at 6:16 PM, yzhk...@gmail.com <yzhk...@gmail.com>wrote: > multipaths { > <% devices.each do |key,value| -%> > multipath { > wwid <%= value %> > alias <%= key %> > } > <% end -%> > } > > On Tue, May 17, 2011 at 2:29 AM, Aaron Grewell <aaron.grew...@gmail.com>wrote: > >> Hi all, >> I'm trying to figure out the intersection of hashes and ERB. I don't know >> Ruby, so I put this together from examples available online and predictably >> it generates an ERB syntax error. Can you point me in the right direction? >> >> ### Call: >> class {'multipath': >> devices => { >> oradata01 => "360050768018280d1f800000000000193", >> oradata02 => "360050768018280d1f800000000000194", >> oradata03 => "360050768018280d1f800000000000195", >> } >> } >> >> ### Class: >> class multipath ($devices) { >> >> package { "device-mapper-multipath": } >> >> file { "/etc/multipath.conf": >> mode => "644", >> content => template("multipath/multipath.conf.erb"), >> notify => Service["multipathd"], >> require => Package["device-mapper-multipath"], >> } # file >> >> service { "multipathd": >> ensure => running, >> enable => true, >> require => Package["device-mapper-multipath"], >> } # service >> } # class mapper >> >> ### Template (multipath.conf.erb): >> >> defaults { >> polling_interval 30 >> failback immediate >> no_path_retry 5 >> rr_min_io 100 >> path_checker tur >> user_friendly_names yes >> } >> >> devices { >> device { >> vendor "IBM" >> product "2145" >> path_grouping_policy group_by_prio >> prio_callout "/sbin/mpath_prio_alua /dev/%n" >> } >> } >> >> multipaths { >> <% devices.each do |alias,wwid| -%> >> multipath { >> wwid <%= wwid %> >> alias <%= alias %> >> } >> <% end -%> >> } >> >> -- >> 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. > -- 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.