Move the config template write to the first actions to be done (#171)
* Move the config template write to the first actions to be done * Shorten the change message
This commit is contained in:
parent
9dfe3a492e
commit
0bfdc5dc01
@ -4,6 +4,8 @@ This file is used to list changes made in each version of the postfix cookbook.
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- Make sure we write the main.conf and master.conf before we try to use any commands (like postmap)
|
||||||
|
|
||||||
## 6.0.1 - *2021-06-01*
|
## 6.0.1 - *2021-06-01*
|
||||||
|
|
||||||
## 6.0.0 - *2020-11-23*
|
## 6.0.0 - *2020-11-23*
|
||||||
|
@ -121,6 +121,26 @@ when 'freebsd'
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# We need to write the config first as the below postmap immediately commands assume config is correct
|
||||||
|
# Which is not the case as ipv6 is assumed to be available by the postfix package
|
||||||
|
# And if someone wants to disable this first we need to update the config first aswell
|
||||||
|
%w( main master ).each do |cfg|
|
||||||
|
template "#{node['postfix']['conf_dir']}/#{cfg}.cf" do
|
||||||
|
source "#{cfg}.cf.erb"
|
||||||
|
owner 'root'
|
||||||
|
group node['root_group']
|
||||||
|
mode '0644'
|
||||||
|
# restart service for solaris on chef-client has a bug
|
||||||
|
# unless condition can be removed after
|
||||||
|
# https://github.com/chef/chef/pull/6596 merge/release
|
||||||
|
notifies :restart, 'service[postfix]' unless platform_family?('solaris2')
|
||||||
|
variables(
|
||||||
|
lazy { { settings: node['postfix'][cfg] } }
|
||||||
|
)
|
||||||
|
cookbook node['postfix']["#{cfg}_template_source"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
execute 'update-postfix-sender_canonical' do
|
execute 'update-postfix-sender_canonical' do
|
||||||
command "postmap #{node['postfix']['conf_dir']}/sender_canonical"
|
command "postmap #{node['postfix']['conf_dir']}/sender_canonical"
|
||||||
action :nothing
|
action :nothing
|
||||||
@ -172,23 +192,6 @@ unless node['postfix']['recipient_canonical_map_entries'].empty?
|
|||||||
node.default['postfix']['main']['recipient_canonical_maps'] = "hash:#{node['postfix']['conf_dir']}/recipient_canonical" unless node['postfix']['main'].key?('recipient_canonical_maps')
|
node.default['postfix']['main']['recipient_canonical_maps'] = "hash:#{node['postfix']['conf_dir']}/recipient_canonical" unless node['postfix']['main'].key?('recipient_canonical_maps')
|
||||||
end
|
end
|
||||||
|
|
||||||
%w( main master ).each do |cfg|
|
|
||||||
template "#{node['postfix']['conf_dir']}/#{cfg}.cf" do
|
|
||||||
source "#{cfg}.cf.erb"
|
|
||||||
owner 'root'
|
|
||||||
group node['root_group']
|
|
||||||
mode '0644'
|
|
||||||
# restart service for solaris on chef-client has a bug
|
|
||||||
# unless condition can be removed after
|
|
||||||
# https://github.com/chef/chef/pull/6596 merge/release
|
|
||||||
notifies :restart, 'service[postfix]' unless platform_family?('solaris2')
|
|
||||||
variables(
|
|
||||||
lazy { { settings: node['postfix'][cfg] } }
|
|
||||||
)
|
|
||||||
cookbook node['postfix']["#{cfg}_template_source"]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
service 'postfix' do
|
service 'postfix' do
|
||||||
supports status: true, restart: true, reload: true
|
supports status: true, restart: true, reload: true
|
||||||
action [:enable, :start]
|
action [:enable, :start]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user