On Jul 24, 2009, at 10:17 PM, lance dillon wrote:

> I need to be able to include a line in a template, based on presence  
> and value of a variable, something like this:
>
> #  file.erb
> blah
> blah blah
> <% if role == "fast" -%>
> this line is here now
> <% end -%>
>
>
>
> I only want the line to be included if $role exists and is equal to  
> fast.  If $role doesn't exist, or doesn't equal "fast", it shouldn't  
> include the line:
>
> Jul 24 19:59:40 lonengbld01 puppetmasterd[3095]: Failed to parse  
> template repo/R
> edHat-4/extras.repo: Could not find value for 'role' at /etc/puppet/ 
> modules/repo
> /manifests/init.pp:121 on node blah
>
> What would be the correct syntax?
>
> Thanks
>
>

Try with something like:

<%- if role == "fast" -%>
     <%- line =  "The line you want to print" -%>
<%- end -%>
<%= line -%>


Regards



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to