Home

Search Posts:

Archives

Login

February 2012

S M T W H F S
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29

Parent Post: Systems administration with puppet

Author: Jeremy

Email: jeremy.thornhill@gmail.com

Url:

Body: j - indeed it does still work, but you have to be careful to avoid trying to load an ERB that includes an undefined variable. The trick is to use a conditional to verify that the variable exists, and if it does then to load the extra template. I do this like so: if $snmpextra { file {"/etc/snmp/snmpd.conf": content => template("snmp/snmpd.conf.erb","snmp/$snmpextra.erb"), mode => 0640, alias => snmpconf, } } else { file {"/etc/snmp/snmpd.conf": content => template("snmp/snmpd.conf.erb"), mode => 0640, alias => snmpconf, } } There are limitations to this approach that do bother me a bit - you can only add one additional snippet, for example. Puppet's conditionals and variable capabilities have undergone substantial improvement since I first configured this, though, and there may well be a better way to do this now!

Edit | Back