Merge pull request #147 from freakinhippie/relayhost-port
add ability to set network connection port for a remote relayhost
This commit is contained in:
commit
68fda8b47d
@ -34,6 +34,7 @@ See `attributes/default.rb` for default values.
|
||||
|
||||
- `node['postfix']['mail_type']` - Sets the kind of mail configuration. `master` will set up a server (relayhost).
|
||||
- `node['postfix']['relayhost_role']` - name of a role used for search in the client recipe.
|
||||
- `node['postfix']['relayhost_port']` - listening network port of the relayhost.
|
||||
- `node['postfix']['multi_environment_relay']` - set to true if nodes should not constrain search for the relayhost in their own environment.
|
||||
- `node['postfix']['use_procmail']` - set to true if nodes should use procmail as the delivery agent.
|
||||
- `node['postfix']['use_alias_maps']` - set to true if you want the cookbook to use/configure alias maps
|
||||
|
@ -17,6 +17,7 @@
|
||||
# Generic cookbook attributes
|
||||
default['postfix']['mail_type'] = 'client'
|
||||
default['postfix']['relayhost_role'] = 'relayhost'
|
||||
default['postfix']['relayhost_port'] = '25'
|
||||
default['postfix']['multi_environment_relay'] = false
|
||||
default['postfix']['use_procmail'] = false
|
||||
default['postfix']['use_alias_maps'] = (node['platform'] == 'freebsd')
|
||||
|
@ -24,6 +24,9 @@ end
|
||||
|
||||
query = "role:#{node['postfix']['relayhost_role']}"
|
||||
relayhost = ''
|
||||
# if the relayhost_port attribute is not port 25, append to the relayhost
|
||||
relayhost_port = node['postfix']['relayhost_port'].to_s != '25' ? ":#{node['postfix']['relayhost_port']}" : ''
|
||||
|
||||
# results = []
|
||||
|
||||
if node.run_list.roles.include?(node['postfix']['relayhost_role'])
|
||||
@ -36,6 +39,6 @@ else
|
||||
relayhost = results.map { |n| n['ipaddress'] }.first
|
||||
end
|
||||
|
||||
node.normal['postfix']['main']['relayhost'] = "[#{relayhost}]"
|
||||
node.normal['postfix']['main']['relayhost'] = "[#{relayhost}]#{relayhost_port}"
|
||||
|
||||
include_recipe 'postfix'
|
||||
|
Loading…
x
Reference in New Issue
Block a user