Here's an example of configuring NTP using Puppet templates.
Directory should look like this:
/etc/puppet/modules/ntp/manifests
                       /templates
/etc/puppet/modules/ntp/manifests/init.pp (portion defining the template):
$ntp_server_suffix = ".ubuntu.pool.ntp.org"
file { '/etc/ntp.conf':
    content => template('ntp/ntp.conf.erb'),
    owner   => root,
    group   => root,
    mode    => 644,
}
 /etc/puppet/modules/ntp/templates/ntp.conf.erb:
driftfile /var/lib/ntp/drift
<% [1,2].each do |n| -%>
server <%=n-%><%=@ntp_server_suffix%>
<% end -%>
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
When run with puppet this will result in an /etc/ntp.conf that looks like:
driftfile /var/lib/ntp/drift
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
The key concepts that you need to keep in mind:
- 
Variables defined in the puppet manifest (such as $ntp_server_suffix can be accessed as instance variables (@ntp_server_suffix) in the template
 
- 
Loops and other ruby code can be used in erb templates
 
- 
Code between <% and %> is executed by ruby
 
- 
Code between <%= and %> is executed and output by ruby
 
- 
Code between <%= and -%> is executed and output by ruby and the trailing newline character is suppressed.
 
Hope this helps!