#66 - [COOK-3652] Added support for transport mappings
Signed-off-by: Sean OMeara <someara@opscode.com>
This commit is contained in:
parent
e2d49e10e9
commit
bfe9cd760e
@ -21,6 +21,7 @@ default['postfix']['relayhost_role'] = 'relayhost'
|
||||
default['postfix']['multi_environment_relay'] = false
|
||||
default['postfix']['use_procmail'] = false
|
||||
default['postfix']['aliases'] = {}
|
||||
default['postfix']['transports'] = {}
|
||||
default['postfix']['main_template_source'] = 'postfix'
|
||||
default['postfix']['master_template_source'] = 'postfix'
|
||||
default['postfix']['sender_canonical_map_entries'] = {}
|
||||
@ -30,13 +31,16 @@ case node['platform']
|
||||
when 'smartos'
|
||||
default['postfix']['conf_dir'] = '/opt/local/etc/postfix'
|
||||
default['postfix']['aliases_db'] = '/opt/local/etc/postfix/aliases'
|
||||
default['postfix']['transport_db'] = '/opt/local/etc/postfix/transport'
|
||||
when 'omnios'
|
||||
default['postfix']['conf_dir'] = '/opt/omni/etc/postfix'
|
||||
default['postfix']['aliases_db'] = 'opt/omni/etc/postfix/aliases'
|
||||
default['postfix']['transport_db'] = '/opt/omni/etc/postfix/transport'
|
||||
default['postfix']['uid'] = 11
|
||||
else
|
||||
default['postfix']['conf_dir'] = '/etc/postfix'
|
||||
default['postfix']['aliases_db'] = '/etc/aliases'
|
||||
default['postfix']['transport_db'] = '/etc/postfix/transport'
|
||||
end
|
||||
|
||||
# Non-default main.cf attributes
|
||||
@ -49,6 +53,7 @@ default['postfix']['main']['mydestination'] = [node['postfix']['main']['myhostna
|
||||
default['postfix']['main']['smtpd_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']['mailbox_size_limit'] = 0
|
||||
default['postfix']['main']['smtp_sasl_auth_enable'] = 'no'
|
||||
default['postfix']['main']['mynetworks'] = '127.0.0.0/8'
|
||||
|
@ -8,6 +8,7 @@ version '3.2.1'
|
||||
recipe 'postfix', 'Installs and configures postfix'
|
||||
recipe 'postfix::sasl_auth', 'Set up postfix to auth to a server with sasl'
|
||||
recipe 'postfix::aliases', 'Manages /etc/aliases'
|
||||
recipe 'postfix::transports', 'Manages /etc/postfix/transport'
|
||||
recipe 'postfix::client', 'Searches for the relayhost based on an attribute'
|
||||
recipe 'postfix::server', 'Sets the mail_type attribute to master'
|
||||
|
||||
@ -22,7 +23,12 @@ attribute 'postfix/main',
|
||||
|
||||
attribute 'postfix/aliases',
|
||||
display_name: 'Postfix Aliases',
|
||||
description: "Hash of Postfix aliases mapping a name to a value. Example 'root' => 'operator@example.com'. See aliases man page for details.",
|
||||
description: "Hash of Postfix aliases mapping a name to a value. Example 'root' => 'operator@example.com'. See aliases man page for details.",
|
||||
type: 'hash'
|
||||
|
||||
attribute 'postfix/transports',
|
||||
display_name: 'Postfix Transports',
|
||||
description: "Hash of Postfix transports mapping a destination to a smtp server. Example 'my.domain' => 'smtp:outbound-relay.my.domain'. See transport man page for details.",
|
||||
type: 'hash'
|
||||
|
||||
attribute 'postfix/mail_type',
|
||||
|
28
recipes/transports.rb
Normal file
28
recipes/transports.rb
Normal file
@ -0,0 +1,28 @@
|
||||
# encoding: utf-8
|
||||
# Copyright:: Copyright (c) 2012, Opscode, 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.
|
||||
#
|
||||
|
||||
include_recipe "postfix"
|
||||
|
||||
execute "update-postfix-transport" do
|
||||
command "postmap #{node['postfix']['transport_db']}"
|
||||
environment PATH: "#{ENV['PATH']}:/opt/omni/bin:/opt/omni/sbin" if platform_family?('omnios')
|
||||
action :nothing
|
||||
end
|
||||
|
||||
template node['postfix']['transport_db'] do
|
||||
source "transport.erb"
|
||||
notifies :run, "execute[update-postfix-transport]"
|
||||
end
|
10
templates/default/transports.erb
Normal file
10
templates/default/transports.erb
Normal file
@ -0,0 +1,10 @@
|
||||
#
|
||||
# This file is generated by Chef for <%= node['fqdn'] %>
|
||||
#
|
||||
# Local changes will be overwritten
|
||||
#
|
||||
# See man 5 transport for format
|
||||
|
||||
<% node['postfix']['transports'].each do |name, value| %>
|
||||
<%= name %> <%= value %>
|
||||
<% end unless node['postfix']['transports'].nil? %>
|
Loading…
x
Reference in New Issue
Block a user