Created
November 28, 2009 04:03
-
-
Save spheromak/244382 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# multi instance stuff | |
if @node[:postfix_multi] | |
# loop over all multi instances and asemble templates. | |
postconf = Hash.new | |
@node[:postfix_multi].each do |instance, settings| | |
# convert postfix config into hash to merge into | |
# mult-instance config | |
h = Hash.new | |
@node[:postfix].each do |k,v| | |
h[k] = v | |
end | |
postconf = h.merge(settings) | |
h.clear | |
template "/etc/#{instance}/main.cf" do | |
source "main.cf.fm.erb" | |
notifies :reload, resources(:service => "postfix") | |
# so much pain here.. need to pass in an array. may as well sort it. | |
# could also use .to_a to flatten this. | |
variables(:postconf => postconf.sort) | |
end | |
postconf.clear | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% @postconf.each do |k, v| -%> | |
<%= k %>=<%= v %> | |
<% end -%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment