> You've lost me a little. So, what I would have to do is:
> 1. Import foreman parser function into my puppet module
Whether or not the class is in Foreman won't affect the functioning of
your class, but obviously you need to do this if you want to apply it
via the ENC 
> 2. Write a template using your snippet eg.
> $hosts = { item => 'hosts',
> search => 'hostgroup=foo',
> foreman_url => 'https://foreman' }
This bit is Puppet code and should be in a .pp file
> <% hosts.each do |host,data| -%><%= host.name %><% end -%>
This bit is ERB and needs to be used in a template (either a real one
or via inline_template()
> 3. Use an inline template to bring this into puppet
See above, this is only if you need the processed data in the .pp
file, otherwise do it all in your template.
> You aren't talking about foreman templates or using ERB in the
> puppetclass->smart_variable functions?
Correct.
Consider this code snippet:
foo/manifests/init.pp
class foo {
$hosts = { item => 'hosts',
search => 'hostgroup=foo',
foreman_url => 'https://foreman'
}
file { '/tmp/foo':
content => template('foo/content.erb')
}
}
foo/templates/content.erb
<% hosts.each do |host, data| -%>
<%= host %>
<%= data.inspect %>
···
On 3 March 2014 09:59, Andrew Lau wrote:
----
<% end -%>
Hopefully you can see how /tmp/foo will contain a pretty-printed
version of the data that came from Foreman, which you can then decide
which bits you need.
Greg