Great, that's done the trick, thanks
Just one thing to note. file() takes an absolute file path (i.e.
/etc/puppet/modules/snmp/templates/snmpd.conf.erb). Spent a few minutes
trying to figure out the error I was getting before finally RTFM.
On Friday, June 29, 2012 2:04:06 PM UTC+1, Darren Chamberlain wrote:
>
>
> * GriffaA10 <alan.griffiths at interoute.com> [2012/06/29 05:35]:
> > I'm trying get Puppet to manage my snmpd instances. I have a
> > "base" snmpd.conf constructed from a template, but some hosts
> > require additional config. My plan was to have something like
> > snmpd.conf.$hostname.erb in the templates directory and
> > concatenate this with the base template. However, for the majority
> > of hosts this file will not be present and in those cases I will
> > get a "Could not find template" error.
>
> The file() function returns the content of the first file that
> exists, so you can use it with inline_template():
>
> file {
> "/etc/snmpd.conf":
> ensure => "present",
> content => inline_template(
> file(
> "puppet:///modules/snmp/snmpd.conf.$::hostname.erb",
> "puppet:///modules/snmp/snmpd.conf.erb",
> )
> ),
> }
>
> --
> Darren Chamberlain <[email protected]>
>
--
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/-/2PbYFufZmD4J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.