Is @path supposed to be the same for each user? If so, you can just put that variable in the block. <% @users.each do |user| %> /bin/mount --bind <%= @path %> /home/<%= user %> <% end %>
If each user has a path value unique to them, you might want to put that in an array of hashes and then iterate over that like this: (in Puppet class) $users = [ { name => 'alice', path => '/alice/path' }, { name => 'bob', path => '/bob/path' } ] (in template) <% @users.each do |user| %> /bin/mount --bind <%= user['path'] %> /home/<%= user['name'] %> <% end %> On Friday, July 27, 2012 1:12:48 AM UTC-7, Jiří Červenka wrote: > > Hi, > I am stuck on this task. I need to generate a file with this content: > ... > /bin/mount --bind /home/some/path/ /home/someuser/www > /bin/mount --bind /home/comple/tely/different/path/ /home/differentuser/www > /bin/mount --bind /home/another/path/ /home/anotheruser/www > . > . > ... > > For each row I need to insert two variables. > > I am able to construct simple loop in erb file, but this does not solve my > problem: > > <% userss.each do |user| -%> > /bin/mount --bind /some/path/<%= user %> /home/somepath/<%= user %> > <% end -%> > > I need loop, whose content looks like this: > > /bin/mount --bind /some/path/<%= path %> /home/somepath/<%= user %> > > Can someone point me in right direction? > > Thanks. > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Lbq0wX5imhoJ. 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.