diff --git a/recipes/default.rb b/recipes/default.rb index eb0a0c6..ca20be4 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -72,12 +72,18 @@ when 'omnios' end end +execute 'update-postfix-sender_canonical' do + command "postmap #{node['postfix']['conf_dir']}/sender_canonical" + action :nothing +end + if !node['postfix']['sender_canonical_map_entries'].empty? template "#{node['postfix']['conf_dir']}/sender_canonical" do owner 'root' group 0 mode '0644' - notifies :restart, 'service[postfix]' + notifies :run, 'execute[update-postfix-sender_canonical]' + notifies :reload, 'service[postfix]' end if !node['postfix']['main'].key?('sender_canonical_maps') diff --git a/templates/default/sender_canonical.erb b/templates/default/sender_canonical.erb new file mode 100644 index 0000000..785a1c3 --- /dev/null +++ b/templates/default/sender_canonical.erb @@ -0,0 +1,10 @@ +# +# This file is generated by Chef for <%= node['fqdn'] %> +# +# Local changes will be overwritten +# +# See man 5 canonical for format + +<% node['postfix']['sender_canonical_map_entries'].each do |name, value| %> +<%= name %> <%= value %> +<% end unless node['postfix']['sender_canonical_map_entries'].nil? %>