* 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 <
dar...@boston.com>