Playing around with puppet today (as always) and stumbled across a sweet pattern in a couple of modules for creating config files from hashes. Particularly good for building overriding config.
So here is the template
mysql.d.cnf.erb
1234567891011121314151617
### MANAGED BY PUPPET ###<% @settings.sort.each do |section, content| -%>
[<%= section %>]<% content.sort.each do |key, values| -%>
<% [values].flatten.sort.each do |value| -%>
<%=value==false ? '#' : '' %><%= key -%><%=case value
when true, false''else" = #{value}" end
%>
<% end -%>
<% end -%>
<% end -%>
So this is obviously awesome. Super flexible no need to define each varible you want to add into config. Just add each var to your node definition…
So far I have used this template style for powerdns and mysql config files but I am sure there are heaps more uses for this style of config generation.