Merge pull request #77 from svanharmelen/COOK-3652-bugfix
Refactoring trying to fix some logic issues
This commit is contained in:
commit
e120b1f61a
@ -23,6 +23,7 @@ default['postfix']['use_procmail'] = false
|
|||||||
default['postfix']['aliases'] = {}
|
default['postfix']['aliases'] = {}
|
||||||
default['postfix']['transports'] = {}
|
default['postfix']['transports'] = {}
|
||||||
default['postfix']['access'] = {}
|
default['postfix']['access'] = {}
|
||||||
|
default['postfix']['virtual_aliases'] = {}
|
||||||
default['postfix']['main_template_source'] = 'postfix'
|
default['postfix']['main_template_source'] = 'postfix'
|
||||||
default['postfix']['master_template_source'] = 'postfix'
|
default['postfix']['master_template_source'] = 'postfix'
|
||||||
default['postfix']['sender_canonical_map_entries'] = {}
|
default['postfix']['sender_canonical_map_entries'] = {}
|
||||||
@ -33,21 +34,21 @@ when 'smartos'
|
|||||||
default['postfix']['conf_dir'] = '/opt/local/etc/postfix'
|
default['postfix']['conf_dir'] = '/opt/local/etc/postfix'
|
||||||
default['postfix']['aliases_db'] = '/opt/local/etc/postfix/aliases'
|
default['postfix']['aliases_db'] = '/opt/local/etc/postfix/aliases'
|
||||||
default['postfix']['transport_db'] = '/opt/local/etc/postfix/transport'
|
default['postfix']['transport_db'] = '/opt/local/etc/postfix/transport'
|
||||||
|
default['postfix']['access_db'] = '/opt/local/etc/postfix/access'
|
||||||
|
default['postfix']['virtual_alias_db'] = '/opt/local/etc/postfix/virtual'
|
||||||
when 'omnios'
|
when 'omnios'
|
||||||
default['postfix']['conf_dir'] = '/opt/omni/etc/postfix'
|
default['postfix']['conf_dir'] = '/opt/omni/etc/postfix'
|
||||||
default['postfix']['aliases_db'] = 'opt/omni/etc/postfix/aliases'
|
default['postfix']['aliases_db'] = 'opt/omni/etc/postfix/aliases'
|
||||||
default['postfix']['transport_db'] = '/opt/omni/etc/postfix/transport'
|
default['postfix']['transport_db'] = '/opt/omni/etc/postfix/transport'
|
||||||
default['postfix']['access_db'] = '/opt/local/etc/postfix/aliases'
|
default['postfix']['access_db'] = '/opt/omni/etc/postfix/access'
|
||||||
when 'omnios'
|
default['postfix']['virtual_alias_db'] = '/etc/omni/etc/postfix/virtual'
|
||||||
default['postfix']['conf_dir'] = '/opt/omni/etc/postfix'
|
|
||||||
default['postfix']['aliases_db'] = 'opt/omni/etc/postfix/aliases'
|
|
||||||
default['postfix']['access_db'] = 'opt/omni/etc/postfix/aliases'
|
|
||||||
default['postfix']['uid'] = 11
|
default['postfix']['uid'] = 11
|
||||||
else
|
else
|
||||||
default['postfix']['conf_dir'] = '/etc/postfix'
|
default['postfix']['conf_dir'] = '/etc/postfix'
|
||||||
default['postfix']['aliases_db'] = '/etc/aliases'
|
default['postfix']['aliases_db'] = '/etc/aliases'
|
||||||
default['postfix']['transport_db'] = '/etc/postfix/transport'
|
default['postfix']['transport_db'] = '/etc/postfix/transport'
|
||||||
default['postfix']['access_db'] = '/etc/postfix/access'
|
default['postfix']['access_db'] = '/etc/postfix/access'
|
||||||
|
default['postfix']['virtual_alias_db'] = '/etc/postfix/virtual'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Non-default main.cf attributes
|
# Non-default main.cf attributes
|
||||||
@ -59,11 +60,12 @@ default['postfix']['main']['myorigin'] = '$myhostname'
|
|||||||
default['postfix']['main']['mydestination'] = [node['postfix']['main']['myhostname'], node['hostname'], 'localhost.localdomain', 'localhost'].compact
|
default['postfix']['main']['mydestination'] = [node['postfix']['main']['myhostname'], node['hostname'], 'localhost.localdomain', 'localhost'].compact
|
||||||
default['postfix']['main']['smtpd_use_tls'] = 'yes'
|
default['postfix']['main']['smtpd_use_tls'] = 'yes'
|
||||||
default['postfix']['main']['smtp_use_tls'] = 'yes'
|
default['postfix']['main']['smtp_use_tls'] = 'yes'
|
||||||
default['postfix']['main']['alias_maps'] = ["hash:#{node['postfix']['aliases_db']}"]
|
|
||||||
default['postfix']['main']['transport_maps'] = [ "hash:#{node['postfix']['transport_db']}" ]
|
|
||||||
default['postfix']['main']['access_maps'] = ["hash:#{node['postfix']['access_db']}"]
|
|
||||||
default['postfix']['main']['mailbox_size_limit'] = 0
|
|
||||||
default['postfix']['main']['smtp_sasl_auth_enable'] = 'no'
|
default['postfix']['main']['smtp_sasl_auth_enable'] = 'no'
|
||||||
|
default['postfix']['main']['use_alias_maps'] = 'no'
|
||||||
|
default['postfix']['main']['use_transport_maps'] = 'no'
|
||||||
|
default['postfix']['main']['use_access_maps'] = 'no'
|
||||||
|
default['postfix']['main']['use_virtual_aliases'] = 'no'
|
||||||
|
default['postfix']['main']['mailbox_size_limit'] = 0
|
||||||
default['postfix']['main']['mynetworks'] = nil
|
default['postfix']['main']['mynetworks'] = nil
|
||||||
default['postfix']['main']['inet_interfaces'] = 'loopback-only'
|
default['postfix']['main']['inet_interfaces'] = 'loopback-only'
|
||||||
|
|
||||||
@ -104,16 +106,20 @@ if node['postfix']['main']['smtp_sasl_auth_enable'] == 'yes'
|
|||||||
default['postfix']['main']['relayhost'] = ''
|
default['postfix']['main']['relayhost'] = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
if node['postfix']['use_virtual_aliases'] == 'yes'
|
if node['postfix']['main']['use_alias_maps'] == 'yes'
|
||||||
default['postfix']['main']['virtual_alias_domains'] = []
|
default['postfix']['main']['alias_maps'] = ["hash:#{node['postfix']['aliases_db']}"]
|
||||||
case node['platform']
|
|
||||||
when 'smartos'
|
|
||||||
default['postfix']['virtual_alias_db'] = '/opt/local/etc/postfix/virtual'
|
|
||||||
else
|
|
||||||
default['postfix']['virtual_alias_db'] = '/etc/postfix/virtual'
|
|
||||||
end
|
end
|
||||||
default['postfix']['main']['virtual_alias_maps'] = "hash:#{node['postfix']['virtual_alias_db']}"
|
|
||||||
default['postfix']['virtual_aliases'] = {}
|
if node['postfix']['main']['use_transport_maps'] == 'yes'
|
||||||
|
default['postfix']['main']['transport_maps'] = ["hash:#{node['postfix']['transport_db']}"]
|
||||||
|
end
|
||||||
|
|
||||||
|
if node['postfix']['main']['use_access_maps'] == 'yes'
|
||||||
|
default['postfix']['main']['access_maps'] = ["hash:#{node['postfix']['access_db']}"]
|
||||||
|
end
|
||||||
|
|
||||||
|
if node['postfix']['main']['use_virtual_aliases'] == 'yes'
|
||||||
|
default['postfix']['main']['virtual_alias_maps'] = ["hash:#{node['postfix']['virtual_alias_db']}"]
|
||||||
end
|
end
|
||||||
|
|
||||||
# # Default main.cf attributes according to `postconf -d`
|
# # Default main.cf attributes according to `postconf -d`
|
||||||
|
@ -10,6 +10,7 @@ recipe 'postfix::sasl_auth', 'Set up postfix to auth to a server with sasl'
|
|||||||
recipe 'postfix::aliases', 'Manages /etc/aliases'
|
recipe 'postfix::aliases', 'Manages /etc/aliases'
|
||||||
recipe 'postfix::transports', 'Manages /etc/postfix/transport'
|
recipe 'postfix::transports', 'Manages /etc/postfix/transport'
|
||||||
recipe 'postfix::access', 'Manages /etc/postfix/access'
|
recipe 'postfix::access', 'Manages /etc/postfix/access'
|
||||||
|
recipe 'postfix::virtual_aliases', 'Manages /etc/postfix/virtual'
|
||||||
recipe 'postfix::client', 'Searches for the relayhost based on an attribute'
|
recipe 'postfix::client', 'Searches for the relayhost based on an attribute'
|
||||||
recipe 'postfix::server', 'Sets the mail_type attribute to master'
|
recipe 'postfix::server', 'Sets the mail_type attribute to master'
|
||||||
|
|
||||||
|
126
recipes/_common.rb
Normal file
126
recipes/_common.rb
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
# encoding: utf-8
|
||||||
|
# Author:: Joshua Timberman(<joshua@getchef.com>)
|
||||||
|
# Cookbook Name:: common
|
||||||
|
# Recipe:: default
|
||||||
|
#
|
||||||
|
# Copyright 2009-2014, Chef Software, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
package 'postfix'
|
||||||
|
|
||||||
|
package 'procmail' if node['postfix']['use_procmail']
|
||||||
|
|
||||||
|
case node['platform_family']
|
||||||
|
when 'rhel', 'fedora'
|
||||||
|
service 'sendmail' do
|
||||||
|
action :nothing
|
||||||
|
end
|
||||||
|
|
||||||
|
execute 'switch_mailer_to_postfix' do
|
||||||
|
command '/usr/sbin/alternatives --set mta /usr/sbin/sendmail.postfix'
|
||||||
|
notifies :stop, 'service[sendmail]'
|
||||||
|
notifies :start, 'service[postfix]'
|
||||||
|
not_if '/usr/bin/test /etc/alternatives/mta -ef /usr/sbin/sendmail.postfix'
|
||||||
|
end
|
||||||
|
when 'omnios'
|
||||||
|
manifest_path = ::File.join(Chef::Config[:file_cache_path], 'manifest-postfix.xml')
|
||||||
|
|
||||||
|
# we need to manage the postfix group and user
|
||||||
|
# and then subscribe to the package install because it creates a
|
||||||
|
# postdrop group and adds postfix user to it.
|
||||||
|
group 'postfix' do
|
||||||
|
append true
|
||||||
|
end
|
||||||
|
|
||||||
|
user 'postfix' do
|
||||||
|
uid node['postfix']['uid']
|
||||||
|
gid 'postfix'
|
||||||
|
home '/var/spool/postfix'
|
||||||
|
subscribes :manage, 'package[postfix]'
|
||||||
|
notifies :run, 'execute[/opt/omni/sbin/postfix set-permissions]', :immediately
|
||||||
|
end
|
||||||
|
|
||||||
|
# we don't guard this because if the user creation was successful (or happened out of band), then this won't get executed when the action is :nothing.
|
||||||
|
execute '/opt/omni/sbin/postfix set-permissions'
|
||||||
|
|
||||||
|
template manifest_path do
|
||||||
|
source 'manifest-postfix.xml.erb'
|
||||||
|
owner 'root'
|
||||||
|
group 'root'
|
||||||
|
mode '0644'
|
||||||
|
notifies :run, 'execute[load postfix manifest]', :immediately
|
||||||
|
end
|
||||||
|
|
||||||
|
execute 'load postfix manifest' do
|
||||||
|
action :nothing
|
||||||
|
command "svccfg import #{manifest_path}"
|
||||||
|
notifies :restart, 'service[postfix]'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
execute 'update-postfix-sender_canonical' do
|
||||||
|
command "postmap #{node['postfix']['conf_dir']}/sender_canonical"
|
||||||
|
action :nothing
|
||||||
|
end
|
||||||
|
|
||||||
|
unless node['postfix']['sender_canonical_map_entries'].empty?
|
||||||
|
template "#{node['postfix']['conf_dir']}/sender_canonical" do
|
||||||
|
owner 'root'
|
||||||
|
group 0
|
||||||
|
mode '0644'
|
||||||
|
notifies :run, 'execute[update-postfix-sender_canonical]'
|
||||||
|
notifies :reload, 'service[postfix]'
|
||||||
|
end
|
||||||
|
|
||||||
|
unless node['postfix']['main'].key?('sender_canonical_maps')
|
||||||
|
node.set['postfix']['main']['sender_canonical_maps'] = "hash:#{node['postfix']['conf_dir']}/sender_canonical"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
execute 'update-postfix-smtp_generic' do
|
||||||
|
command "postmap #{node['postfix']['conf_dir']}/smtp_generic"
|
||||||
|
action :nothing
|
||||||
|
end
|
||||||
|
|
||||||
|
unless node['postfix']['smtp_generic_map_entries'].empty?
|
||||||
|
template "#{node['postfix']['conf_dir']}/smtp_generic" do
|
||||||
|
owner 'root'
|
||||||
|
group 0
|
||||||
|
mode '0644'
|
||||||
|
notifies :run, 'execute[update-postfix-smtp_generic]'
|
||||||
|
notifies :reload, 'service[postfix]'
|
||||||
|
end
|
||||||
|
|
||||||
|
unless node['postfix']['main'].key?('smtp_generic_maps')
|
||||||
|
node.set['postfix']['main']['smtp_generic_maps'] = "hash:#{node['postfix']['conf_dir']}/smtp_generic"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
%w{main master}.each do |cfg|
|
||||||
|
template "#{node['postfix']['conf_dir']}/#{cfg}.cf" do
|
||||||
|
source "#{cfg}.cf.erb"
|
||||||
|
owner 'root'
|
||||||
|
group 0
|
||||||
|
mode '0644'
|
||||||
|
notifies :restart, 'service[postfix]'
|
||||||
|
variables(settings: node['postfix'][cfg])
|
||||||
|
cookbook node['postfix']["#{cfg}_template_source"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
service 'postfix' do
|
||||||
|
supports status: true, restart: true, reload: true
|
||||||
|
action :enable
|
||||||
|
end
|
@ -14,15 +14,15 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
include_recipe "postfix"
|
include_recipe 'postfix::_common'
|
||||||
|
|
||||||
execute "update-postfix-access" do
|
execute 'update-postfix-access' do
|
||||||
command "postmap #{node['postfix']['access_db']}"
|
command "postmap #{node['postfix']['access_db']}"
|
||||||
environment PATH: "#{ENV['PATH']}:/opt/omni/bin:/opt/omni/sbin" if platform_family?('omnios')
|
environment PATH: "#{ENV['PATH']}:/opt/omni/bin:/opt/omni/sbin" if platform_family?('omnios')
|
||||||
action :nothing
|
action :nothing
|
||||||
end
|
end
|
||||||
|
|
||||||
template "/etc/postfix/access" do
|
template node['postfix']['access_db'] do
|
||||||
source "access.erb"
|
source 'access.erb'
|
||||||
notifies :run, "execute[update-postfix-access]"
|
notifies :run, 'execute[update-postfix-access]'
|
||||||
end
|
end
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
include_recipe 'postfix'
|
include_recipe 'postfix::_common'
|
||||||
|
|
||||||
execute 'update-postfix-aliases' do
|
execute 'update-postfix-aliases' do
|
||||||
command 'newaliases'
|
command 'newaliases'
|
||||||
|
@ -18,109 +18,24 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
package 'postfix'
|
include_recipe 'postfix::_common'
|
||||||
|
|
||||||
package 'procmail' if node['postfix']['use_procmail']
|
if node['postfix']['main']['smtp_sasl_auth_enable'] == 'yes'
|
||||||
|
include_recipe 'postfix::sasl_auth'
|
||||||
case node['platform_family']
|
|
||||||
when 'rhel', 'fedora'
|
|
||||||
service 'sendmail' do
|
|
||||||
action :nothing
|
|
||||||
end
|
end
|
||||||
|
|
||||||
execute 'switch_mailer_to_postfix' do
|
if node['postfix']['main']['use_alias_maps'] == 'yes'
|
||||||
command '/usr/sbin/alternatives --set mta /usr/sbin/sendmail.postfix'
|
include_recipe 'postfix::aliases'
|
||||||
notifies :stop, 'service[sendmail]'
|
|
||||||
notifies :start, 'service[postfix]'
|
|
||||||
not_if '/usr/bin/test /etc/alternatives/mta -ef /usr/sbin/sendmail.postfix'
|
|
||||||
end
|
|
||||||
when 'omnios'
|
|
||||||
manifest_path = ::File.join(Chef::Config[:file_cache_path], 'manifest-postfix.xml')
|
|
||||||
|
|
||||||
# we need to manage the postfix group and user
|
|
||||||
# and then subscribe to the package install because it creates a
|
|
||||||
# postdrop group and adds postfix user to it.
|
|
||||||
group 'postfix' do
|
|
||||||
append true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
user 'postfix' do
|
if node['postfix']['main']['use_transport_maps'] == 'yes'
|
||||||
uid node['postfix']['uid']
|
include_recipe 'postfix::transports'
|
||||||
gid 'postfix'
|
|
||||||
home '/var/spool/postfix'
|
|
||||||
subscribes :manage, 'package[postfix]'
|
|
||||||
notifies :run, 'execute[/opt/omni/sbin/postfix set-permissions]', :immediately
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# we don't guard this because if the user creation was successful (or happened out of band), then this won't get executed when the action is :nothing.
|
if node['postfix']['main']['use_access_maps'] == 'yes'
|
||||||
execute '/opt/omni/sbin/postfix set-permissions'
|
include_recipe 'postfix::access'
|
||||||
|
|
||||||
template manifest_path do
|
|
||||||
source 'manifest-postfix.xml.erb'
|
|
||||||
owner 'root'
|
|
||||||
group 'root'
|
|
||||||
mode '0644'
|
|
||||||
notifies :run, 'execute[load postfix manifest]', :immediately
|
|
||||||
end
|
end
|
||||||
|
|
||||||
execute 'load postfix manifest' do
|
if node['postfix']['main']['use_virtual_aliases'] == 'yes'
|
||||||
action :nothing
|
include_recipe 'postfix::virtual_aliases'
|
||||||
command "svccfg import #{manifest_path}"
|
|
||||||
notifies :restart, 'service[postfix]'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
execute 'update-postfix-sender_canonical' do
|
|
||||||
command "postmap #{node['postfix']['conf_dir']}/sender_canonical"
|
|
||||||
action :nothing
|
|
||||||
end
|
|
||||||
|
|
||||||
unless node['postfix']['sender_canonical_map_entries'].empty?
|
|
||||||
template "#{node['postfix']['conf_dir']}/sender_canonical" do
|
|
||||||
owner 'root'
|
|
||||||
group 0
|
|
||||||
mode '0644'
|
|
||||||
notifies :run, 'execute[update-postfix-sender_canonical]'
|
|
||||||
notifies :reload, 'service[postfix]'
|
|
||||||
end
|
|
||||||
|
|
||||||
unless node['postfix']['main'].key?('sender_canonical_maps')
|
|
||||||
node.set['postfix']['main']['sender_canonical_maps'] = "hash:#{node['postfix']['conf_dir']}/sender_canonical"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
execute 'update-postfix-smtp_generic' do
|
|
||||||
command "postmap #{node['postfix']['conf_dir']}/smtp_generic"
|
|
||||||
action :nothing
|
|
||||||
end
|
|
||||||
|
|
||||||
if !node['postfix']['smtp_generic_map_entries'].empty?
|
|
||||||
template "#{node['postfix']['conf_dir']}/smtp_generic" do
|
|
||||||
owner 'root'
|
|
||||||
group 0
|
|
||||||
mode '0644'
|
|
||||||
notifies :run, 'execute[update-postfix-smtp_generic]'
|
|
||||||
notifies :reload, 'service[postfix]'
|
|
||||||
end
|
|
||||||
|
|
||||||
if !node['postfix']['main'].key?('smtp_generic_maps')
|
|
||||||
node.set['postfix']['main']['smtp_generic_maps'] = "hash:#{node['postfix']['conf_dir']}/smtp_generic"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
%w{main master}.each do |cfg|
|
|
||||||
template "#{node['postfix']['conf_dir']}/#{cfg}.cf" do
|
|
||||||
source "#{cfg}.cf.erb"
|
|
||||||
owner 'root'
|
|
||||||
group 0
|
|
||||||
mode '0644'
|
|
||||||
notifies :restart, 'service[postfix]'
|
|
||||||
variables(settings: node['postfix'][cfg])
|
|
||||||
cookbook node['postfix']["#{cfg}_template_source"]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
service 'postfix' do
|
|
||||||
supports status: true, restart: true, reload: true
|
|
||||||
action [:enable, :start]
|
|
||||||
end
|
end
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
include_recipe 'postfix'
|
include_recipe 'postfix::_common'
|
||||||
|
|
||||||
sasl_pkgs = []
|
sasl_pkgs = []
|
||||||
|
|
||||||
|
@ -14,15 +14,15 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
include_recipe "postfix"
|
include_recipe 'postfix::_common'
|
||||||
|
|
||||||
execute "update-postfix-transport" do
|
execute 'update-postfix-transport' do
|
||||||
command "postmap #{node['postfix']['transport_db']}"
|
command "postmap #{node['postfix']['transport_db']}"
|
||||||
environment PATH: "#{ENV['PATH']}:/opt/omni/bin:/opt/omni/sbin" if platform_family?('omnios')
|
environment PATH: "#{ENV['PATH']}:/opt/omni/bin:/opt/omni/sbin" if platform_family?('omnios')
|
||||||
action :nothing
|
action :nothing
|
||||||
end
|
end
|
||||||
|
|
||||||
template node['postfix']['transport_db'] do
|
template node['postfix']['transport_db'] do
|
||||||
source "transport.erb"
|
source 'transport.erb'
|
||||||
notifies :run, "execute[update-postfix-transport]"
|
notifies :run, 'execute[update-postfix-transport]'
|
||||||
end
|
end
|
||||||
|
@ -14,18 +14,15 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
include_recipe 'postfix'
|
include_recipe 'postfix::_common'
|
||||||
|
|
||||||
execute 'postmap-virtual-alias' do
|
execute 'update-postfix-virtual-alias' do
|
||||||
command "postmap #{node['postfix']['main']['virtual_alias_maps']}"
|
command "postmap #{node['postfix']['virtual_alias_db']}"
|
||||||
|
environment PATH: "#{ENV['PATH']}:/opt/omni/bin:/opt/omni/sbin" if platform_family?('omnios')
|
||||||
action :nothing
|
action :nothing
|
||||||
end
|
end
|
||||||
|
|
||||||
template node['postfix']['virtual_alias_db'] do
|
template node['postfix']['virtual_alias_db'] do
|
||||||
source 'virtual_aliases.erb'
|
source 'virtual_aliases.erb'
|
||||||
owner 'root'
|
notifies :run, 'execute[update-postfix-virtual-alias]'
|
||||||
group 'root'
|
|
||||||
mode 0400
|
|
||||||
notifies :run, 'execute[postmap-virtual-alias]', :immediately
|
|
||||||
notifies :restart, 'service[postfix]'
|
|
||||||
end
|
end
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
|
|
||||||
<% node['postfix']['virtual_aliases'].each do |key, value| %>
|
<% node['postfix']['virtual_aliases'].each do |key, value| %>
|
||||||
<%= key %> <%= value %>
|
<%= key %> <%= value %>
|
||||||
<% end %>
|
<% end unless node['postfix']['virtual_aliases'].nil? %>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user